Skip to content

Commit

Permalink
JDO-830: Migrate JUnit tests in tck to version 5
Browse files Browse the repository at this point in the history
skip test classes in comments
  • Loading branch information
mboapache committed Nov 26, 2023
1 parent ffe5c2b commit 4a03d88
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ private PropertyUtils() {
* @param col collection to contain String items
*/
public static void string2Collection(String names, Collection<String> col) {
String[] items = names.split("[ \t\n,;]+");
String[] items = names.split(Utilities.DELIMITER_REGEX);
col.addAll(Arrays.asList(items));
}

Expand Down
4 changes: 3 additions & 1 deletion exectck/src/main/java/org/apache/jdo/exectck/RunTCK.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
import java.util.Properties;
import java.util.logging.Level;
import java.util.logging.Logger;
import java.util.stream.Collectors;
import org.apache.commons.io.FileUtils;
import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugins.annotations.Mojo;
Expand Down Expand Up @@ -479,7 +480,8 @@ private List<String> getTestClasses(Properties props, String cfg, String exclude
classes = Utilities.removeSubstrs(classes, excludeList);
List<String> classesList = new ArrayList();
PropertyUtils.string2Collection(classes, classesList);
return classesList;
// skip test classes in comments
return classesList.stream().filter(n -> !n.startsWith("#")).collect(Collectors.toList());
}

/**
Expand Down
7 changes: 5 additions & 2 deletions exectck/src/main/java/org/apache/jdo/exectck/Utilities.java
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,13 @@

public class Utilities {

private Utilities() {}
static final String DELIMITER_REGEX = "[ \t\n,;]+";

private static final String DATE_FORMAT_NOW = "yyyyMMdd-HHmmss";

private Utilities() {
// This method is deliberately left empty.
}
/*
* Return the current date/time as a String.
*/
Expand All @@ -58,7 +61,7 @@ public static String urls2ClasspathString(List<URL> urls) {
}

public static String removeSubstrs(String original, String exclude) {
String[] deleteThese = exclude.split(" ");
String[] deleteThese = exclude.split(DELIMITER_REGEX);
String filtered = original;
for (String sub : deleteThese) {
filtered = filtered.replaceAll(sub.trim(), "");
Expand Down

0 comments on commit 4a03d88

Please sign in to comment.