diff --git a/core b/core index a0c7e44..e6b9a55 160000 --- a/core +++ b/core @@ -1 +1 @@ -Subproject commit a0c7e44737615da842fd8e46b8b81ec004b0a1cd +Subproject commit e6b9a55e2e98a2889229fb9c030fc7a35bf682f4 diff --git a/src/bld/java/rife/BldBuild.java b/src/bld/java/rife/BldBuild.java index 9a0ed51..d4e2029 100644 --- a/src/bld/java/rife/BldBuild.java +++ b/src/bld/java/rife/BldBuild.java @@ -32,7 +32,7 @@ public BldBuild() repositories = List.of(MAVEN_CENTRAL, RIFE2_RELEASES); scope(test) - .include(dependency("org.json", "json", version(20230618))); + .include(dependency("org.json", "json", version(20231013))); var core_directory = new File(workDirectory(), "core"); var core_src_directory = new File(core_directory, "src"); diff --git a/src/main/java/rife/bld/blueprints/BlankProjectBlueprint.java b/src/main/java/rife/bld/blueprints/BlankProjectBlueprint.java index 3a6937f..8445195 100644 --- a/src/main/java/rife/bld/blueprints/BlankProjectBlueprint.java +++ b/src/main/java/rife/bld/blueprints/BlankProjectBlueprint.java @@ -37,7 +37,7 @@ public BlankProjectBlueprint(File work, String packageName, String projectName, downloadSources = true; repositories = List.of(MAVEN_CENTRAL, SONATYPE_SNAPSHOTS); scope(test) - .include(dependency("org.junit.jupiter", "junit-jupiter", version(5,9,3))) - .include(dependency("org.junit.platform", "junit-platform-console-standalone", version(1,9,3))); + .include(dependency("org.junit.jupiter", "junit-jupiter", version(5,10,0))) + .include(dependency("org.junit.platform", "junit-platform-console-standalone", version(1,10,0))); } } \ No newline at end of file diff --git a/src/main/java/rife/bld/blueprints/Rife2ProjectBlueprint.java b/src/main/java/rife/bld/blueprints/Rife2ProjectBlueprint.java index 2efd822..a7da02c 100644 --- a/src/main/java/rife/bld/blueprints/Rife2ProjectBlueprint.java +++ b/src/main/java/rife/bld/blueprints/Rife2ProjectBlueprint.java @@ -40,13 +40,13 @@ public Rife2ProjectBlueprint(File work, String packageName, String projectName, scope(compile) .include(dependency("com.uwyn.rife2", "rife2", version(1,7,2))); scope(test) - .include(dependency("org.jsoup", "jsoup", version(1,16,1))) - .include(dependency("org.junit.jupiter", "junit-jupiter", version(5,9,3))) - .include(dependency("org.junit.platform", "junit-platform-console-standalone", version(1,9,3))); + .include(dependency("org.jsoup", "jsoup", version(1,16,2))) + .include(dependency("org.junit.jupiter", "junit-jupiter", version(5,10,0))) + .include(dependency("org.junit.platform", "junit-platform-console-standalone", version(1,10,0))); scope(standalone) .include(dependency("org.eclipse.jetty", "jetty-server", version(11,0,15))) .include(dependency("org.eclipse.jetty", "jetty-servlet", version(11,0,15))) - .include(dependency("org.slf4j", "slf4j-simple", version(2,0,7))); + .include(dependency("org.slf4j", "slf4j-simple", version(2,0,9))); precompileOperation().templateTypes(TemplateType.HTML); } diff --git a/src/main/java/rife/bld/operations/JUnitOperation.java b/src/main/java/rife/bld/operations/JUnitOperation.java index c13b3f0..7aae331 100644 --- a/src/main/java/rife/bld/operations/JUnitOperation.java +++ b/src/main/java/rife/bld/operations/JUnitOperation.java @@ -5,6 +5,11 @@ package rife.bld.operations; import rife.bld.BaseProject; +import rife.tools.FileUtils; + +import java.util.ArrayList; +import java.util.List; +import java.util.regex.Pattern; /** * Tests a Java application with JUnit. @@ -24,6 +29,39 @@ protected JUnitOptions createTestToolOptions() { return new JUnitOptions(); } + @Override + protected List executeConstructProcessCommandList() { + if (mainClass() == null) { + throw new IllegalArgumentException("ERROR: Missing main class for test execution."); + } + + var args = new ArrayList(); + args.add(javaTool()); + args.addAll(javaOptions()); + args.add("-cp"); + var classpath = FileUtils.joinPaths(classpath()); + args.add(classpath); + args.add(mainClass()); + // the JUnit console launcher syntax changed in v1.10.x, + // this logic defaults to the new syntax but if it finds an older + // JUnit jar in the classpath, uses the old syntax + var junit_version_1_10_and_later = true; + var junit_version_pattern = Pattern.compile("junit-platform-console-standalone-(\\d+)\\.(\\d+)\\."); + var junit_version_matcher = junit_version_pattern.matcher(classpath); + if (junit_version_matcher.find() && + (Integer.parseInt(junit_version_matcher.group(1)) < 1 || + (Integer.parseInt(junit_version_matcher.group(1)) == 1 && + Integer.parseInt(junit_version_matcher.group(2)) < 10))) { + junit_version_1_10_and_later = false; + } + if (junit_version_1_10_and_later) { + args.add("execute"); + } + args.addAll(testToolOptions()); + + return args; + } + @Override public JUnitOperation fromProject(BaseProject project) { super.fromProject(project); diff --git a/src/test/java/rife/bld/operations/TestCreateBlankOperation.java b/src/test/java/rife/bld/operations/TestCreateBlankOperation.java index 20e0290..c66e3ec 100644 --- a/src/test/java/rife/bld/operations/TestCreateBlankOperation.java +++ b/src/test/java/rife/bld/operations/TestCreateBlankOperation.java @@ -99,22 +99,22 @@ void testExecute() /myapp/lib/test /myapp/lib/test/apiguardian-api-1\\.1\\.2-sources\\.jar /myapp/lib/test/apiguardian-api-1\\.1\\.2\\.jar - /myapp/lib/test/junit-jupiter-5\\.9\\.3-sources\\.jar - /myapp/lib/test/junit-jupiter-5\\.9\\.3\\.jar - /myapp/lib/test/junit-jupiter-api-5\\.9\\.3-sources\\.jar - /myapp/lib/test/junit-jupiter-api-5\\.9\\.3\\.jar - /myapp/lib/test/junit-jupiter-engine-5\\.9\\.3-sources\\.jar - /myapp/lib/test/junit-jupiter-engine-5\\.9\\.3\\.jar - /myapp/lib/test/junit-jupiter-params-5\\.9\\.3-sources\\.jar - /myapp/lib/test/junit-jupiter-params-5\\.9\\.3\\.jar - /myapp/lib/test/junit-platform-commons-1\\.9\\.3-sources\\.jar - /myapp/lib/test/junit-platform-commons-1\\.9\\.3\\.jar - /myapp/lib/test/junit-platform-console-standalone-1\\.9\\.3-sources\\.jar - /myapp/lib/test/junit-platform-console-standalone-1\\.9\\.3\\.jar - /myapp/lib/test/junit-platform-engine-1\\.9\\.3-sources\\.jar - /myapp/lib/test/junit-platform-engine-1\\.9\\.3\\.jar - /myapp/lib/test/opentest4j-1\\.2\\.0-sources\\.jar - /myapp/lib/test/opentest4j-1\\.2\\.0\\.jar + /myapp/lib/test/junit-jupiter-5\\.10\\.0-sources\\.jar + /myapp/lib/test/junit-jupiter-5\\.10\\.0\\.jar + /myapp/lib/test/junit-jupiter-api-5\\.10\\.0-sources\\.jar + /myapp/lib/test/junit-jupiter-api-5\\.10\\.0\\.jar + /myapp/lib/test/junit-jupiter-engine-5\\.10\\.0-sources\\.jar + /myapp/lib/test/junit-jupiter-engine-5\\.10\\.0\\.jar + /myapp/lib/test/junit-jupiter-params-5\\.10\\.0-sources\\.jar + /myapp/lib/test/junit-jupiter-params-5\\.10\\.0\\.jar + /myapp/lib/test/junit-platform-commons-1\\.10\\.0-sources\\.jar + /myapp/lib/test/junit-platform-commons-1\\.10\\.0\\.jar + /myapp/lib/test/junit-platform-console-standalone-1\\.10\\.0-sources\\.jar + /myapp/lib/test/junit-platform-console-standalone-1\\.10\\.0\\.jar + /myapp/lib/test/junit-platform-engine-1\\.10\\.0-sources\\.jar + /myapp/lib/test/junit-platform-engine-1\\.10\\.0\\.jar + /myapp/lib/test/opentest4j-1\\.3\\.0-sources\\.jar + /myapp/lib/test/opentest4j-1\\.3\\.0\\.jar /myapp/src /myapp/src/bld /myapp/src/bld/java @@ -178,22 +178,22 @@ void testExecute() /myapp/lib/test /myapp/lib/test/apiguardian-api-1\\.1\\.2-sources\\.jar /myapp/lib/test/apiguardian-api-1\\.1\\.2\\.jar - /myapp/lib/test/junit-jupiter-5\\.9\\.3-sources\\.jar - /myapp/lib/test/junit-jupiter-5\\.9\\.3\\.jar - /myapp/lib/test/junit-jupiter-api-5\\.9\\.3-sources\\.jar - /myapp/lib/test/junit-jupiter-api-5\\.9\\.3\\.jar - /myapp/lib/test/junit-jupiter-engine-5\\.9\\.3-sources\\.jar - /myapp/lib/test/junit-jupiter-engine-5\\.9\\.3\\.jar - /myapp/lib/test/junit-jupiter-params-5\\.9\\.3-sources\\.jar - /myapp/lib/test/junit-jupiter-params-5\\.9\\.3\\.jar - /myapp/lib/test/junit-platform-commons-1\\.9\\.3-sources\\.jar - /myapp/lib/test/junit-platform-commons-1\\.9\\.3\\.jar - /myapp/lib/test/junit-platform-console-standalone-1\\.9\\.3-sources\\.jar - /myapp/lib/test/junit-platform-console-standalone-1\\.9\\.3\\.jar - /myapp/lib/test/junit-platform-engine-1\\.9\\.3-sources\\.jar - /myapp/lib/test/junit-platform-engine-1\\.9\\.3\\.jar - /myapp/lib/test/opentest4j-1\\.2\\.0-sources\\.jar - /myapp/lib/test/opentest4j-1\\.2\\.0\\.jar + /myapp/lib/test/junit-jupiter-5\\.10\\.0-sources\\.jar + /myapp/lib/test/junit-jupiter-5\\.10\\.0\\.jar + /myapp/lib/test/junit-jupiter-api-5\\.10\\.0-sources\\.jar + /myapp/lib/test/junit-jupiter-api-5\\.10\\.0\\.jar + /myapp/lib/test/junit-jupiter-engine-5\\.10\\.0-sources\\.jar + /myapp/lib/test/junit-jupiter-engine-5\\.10\\.0\\.jar + /myapp/lib/test/junit-jupiter-params-5\\.10\\.0-sources\\.jar + /myapp/lib/test/junit-jupiter-params-5\\.10\\.0\\.jar + /myapp/lib/test/junit-platform-commons-1\\.10\\.0-sources\\.jar + /myapp/lib/test/junit-platform-commons-1\\.10\\.0\\.jar + /myapp/lib/test/junit-platform-console-standalone-1\\.10\\.0-sources\\.jar + /myapp/lib/test/junit-platform-console-standalone-1\\.10\\.0\\.jar + /myapp/lib/test/junit-platform-engine-1\\.10\\.0-sources\\.jar + /myapp/lib/test/junit-platform-engine-1\\.10\\.0\\.jar + /myapp/lib/test/opentest4j-1\\.3\\.0-sources\\.jar + /myapp/lib/test/opentest4j-1\\.3\\.0\\.jar /myapp/src /myapp/src/bld /myapp/src/bld/java @@ -374,22 +374,22 @@ void testExecuteLocalDependencies() /myapp/lib/local /myapp/lib/local/apiguardian-api-1\\.1\\.2-sources\\.jar /myapp/lib/local/apiguardian-api-1\\.1\\.2\\.jar - /myapp/lib/local/junit-jupiter-5\\.9\\.3-sources\\.jar - /myapp/lib/local/junit-jupiter-5\\.9\\.3\\.jar - /myapp/lib/local/junit-jupiter-api-5\\.9\\.3-sources\\.jar - /myapp/lib/local/junit-jupiter-api-5\\.9\\.3\\.jar - /myapp/lib/local/junit-jupiter-engine-5\\.9\\.3-sources\\.jar - /myapp/lib/local/junit-jupiter-engine-5\\.9\\.3\\.jar - /myapp/lib/local/junit-jupiter-params-5\\.9\\.3-sources\\.jar - /myapp/lib/local/junit-jupiter-params-5\\.9\\.3\\.jar - /myapp/lib/local/junit-platform-commons-1\\.9\\.3-sources\\.jar - /myapp/lib/local/junit-platform-commons-1\\.9\\.3\\.jar - /myapp/lib/local/junit-platform-console-standalone-1\\.9\\.3-sources\\.jar - /myapp/lib/local/junit-platform-console-standalone-1\\.9\\.3\\.jar - /myapp/lib/local/junit-platform-engine-1\\.9\\.3-sources\\.jar - /myapp/lib/local/junit-platform-engine-1\\.9\\.3\\.jar - /myapp/lib/local/opentest4j-1\\.2\\.0-sources\\.jar - /myapp/lib/local/opentest4j-1\\.2\\.0\\.jar + /myapp/lib/local/junit-jupiter-5\\.10\\.0-sources\\.jar + /myapp/lib/local/junit-jupiter-5\\.10\\.0\\.jar + /myapp/lib/local/junit-jupiter-api-5\\.10\\.0-sources\\.jar + /myapp/lib/local/junit-jupiter-api-5\\.10\\.0\\.jar + /myapp/lib/local/junit-jupiter-engine-5\\.10\\.0-sources\\.jar + /myapp/lib/local/junit-jupiter-engine-5\\.10\\.0\\.jar + /myapp/lib/local/junit-jupiter-params-5\\.10\\.0-sources\\.jar + /myapp/lib/local/junit-jupiter-params-5\\.10\\.0\\.jar + /myapp/lib/local/junit-platform-commons-1\\.10\\.0-sources\\.jar + /myapp/lib/local/junit-platform-commons-1\\.10\\.0\\.jar + /myapp/lib/local/junit-platform-console-standalone-1\\.10\\.0-sources\\.jar + /myapp/lib/local/junit-platform-console-standalone-1\\.10\\.0\\.jar + /myapp/lib/local/junit-platform-engine-1\\.10\\.0-sources\\.jar + /myapp/lib/local/junit-platform-engine-1\\.10\\.0\\.jar + /myapp/lib/local/opentest4j-1\\.3\\.0-sources\\.jar + /myapp/lib/local/opentest4j-1\\.3\\.0\\.jar /myapp/lib/runtime /myapp/lib/test /myapp/src @@ -495,22 +495,22 @@ void testExecuteLocalDependenciesFolders() /myapp/lib/local_test /myapp/lib/local_test/apiguardian-api-1\\.1\\.2-sources\\.jar /myapp/lib/local_test/apiguardian-api-1\\.1\\.2\\.jar - /myapp/lib/local_test/junit-jupiter-5\\.9\\.3-sources\\.jar - /myapp/lib/local_test/junit-jupiter-5\\.9\\.3\\.jar - /myapp/lib/local_test/junit-jupiter-api-5\\.9\\.3-sources\\.jar - /myapp/lib/local_test/junit-jupiter-api-5\\.9\\.3\\.jar - /myapp/lib/local_test/junit-jupiter-engine-5\\.9\\.3-sources\\.jar - /myapp/lib/local_test/junit-jupiter-engine-5\\.9\\.3\\.jar - /myapp/lib/local_test/junit-jupiter-params-5\\.9\\.3-sources\\.jar - /myapp/lib/local_test/junit-jupiter-params-5\\.9\\.3\\.jar - /myapp/lib/local_test/junit-platform-commons-1\\.9\\.3-sources\\.jar - /myapp/lib/local_test/junit-platform-commons-1\\.9\\.3\\.jar - /myapp/lib/local_test/junit-platform-console-standalone-1\\.9\\.3-sources\\.jar - /myapp/lib/local_test/junit-platform-console-standalone-1\\.9\\.3\\.jar - /myapp/lib/local_test/junit-platform-engine-1\\.9\\.3-sources\\.jar - /myapp/lib/local_test/junit-platform-engine-1\\.9\\.3\\.jar - /myapp/lib/local_test/opentest4j-1\\.2\\.0-sources\\.jar - /myapp/lib/local_test/opentest4j-1\\.2\\.0\\.jar + /myapp/lib/local_test/junit-jupiter-5\\.10\\.0-sources\\.jar + /myapp/lib/local_test/junit-jupiter-5\\.10\\.0\\.jar + /myapp/lib/local_test/junit-jupiter-api-5\\.10\\.0-sources\\.jar + /myapp/lib/local_test/junit-jupiter-api-5\\.10\\.0\\.jar + /myapp/lib/local_test/junit-jupiter-engine-5\\.10\\.0-sources\\.jar + /myapp/lib/local_test/junit-jupiter-engine-5\\.10\\.0\\.jar + /myapp/lib/local_test/junit-jupiter-params-5\\.10\\.0-sources\\.jar + /myapp/lib/local_test/junit-jupiter-params-5\\.10\\.0\\.jar + /myapp/lib/local_test/junit-platform-commons-1\\.10\\.0-sources\\.jar + /myapp/lib/local_test/junit-platform-commons-1\\.10\\.0\\.jar + /myapp/lib/local_test/junit-platform-console-standalone-1\\.10\\.0-sources\\.jar + /myapp/lib/local_test/junit-platform-console-standalone-1\\.10\\.0\\.jar + /myapp/lib/local_test/junit-platform-engine-1\\.10\\.0-sources\\.jar + /myapp/lib/local_test/junit-platform-engine-1\\.10\\.0\\.jar + /myapp/lib/local_test/opentest4j-1\\.3\\.0-sources\\.jar + /myapp/lib/local_test/opentest4j-1\\.3\\.0\\.jar /myapp/lib/runtime /myapp/lib/test /myapp/src diff --git a/src/test/java/rife/bld/operations/TestCreateRife2Operation.java b/src/test/java/rife/bld/operations/TestCreateRife2Operation.java index d7b58bd..5ef45de 100644 --- a/src/test/java/rife/bld/operations/TestCreateRife2Operation.java +++ b/src/test/java/rife/bld/operations/TestCreateRife2Operation.java @@ -118,31 +118,31 @@ void testExecute() /myapp/lib/standalone/jetty-servlet-11\\.0\\.15\\.jar /myapp/lib/standalone/jetty-util-11\\.0\\.15-sources\\.jar /myapp/lib/standalone/jetty-util-11\\.0\\.15\\.jar - /myapp/lib/standalone/slf4j-api-2\\.0\\.7-sources\\.jar - /myapp/lib/standalone/slf4j-api-2\\.0\\.7\\.jar - /myapp/lib/standalone/slf4j-simple-2\\.0\\.7-sources\\.jar - /myapp/lib/standalone/slf4j-simple-2\\.0\\.7\\.jar + /myapp/lib/standalone/slf4j-api-2\\.0\\.9-sources\\.jar + /myapp/lib/standalone/slf4j-api-2\\.0\\.9\\.jar + /myapp/lib/standalone/slf4j-simple-2\\.0\\.9-sources\\.jar + /myapp/lib/standalone/slf4j-simple-2\\.0\\.9\\.jar /myapp/lib/test /myapp/lib/test/apiguardian-api-1\\.1\\.2-sources\\.jar /myapp/lib/test/apiguardian-api-1\\.1\\.2\\.jar - /myapp/lib/test/jsoup-1\\.16\\.1-sources\\.jar - /myapp/lib/test/jsoup-1\\.16\\.1\\.jar - /myapp/lib/test/junit-jupiter-5\\.9\\.3-sources\\.jar - /myapp/lib/test/junit-jupiter-5\\.9\\.3\\.jar - /myapp/lib/test/junit-jupiter-api-5\\.9\\.3-sources\\.jar - /myapp/lib/test/junit-jupiter-api-5\\.9\\.3\\.jar - /myapp/lib/test/junit-jupiter-engine-5\\.9\\.3-sources\\.jar - /myapp/lib/test/junit-jupiter-engine-5\\.9\\.3\\.jar - /myapp/lib/test/junit-jupiter-params-5\\.9\\.3-sources\\.jar - /myapp/lib/test/junit-jupiter-params-5\\.9\\.3\\.jar - /myapp/lib/test/junit-platform-commons-1\\.9\\.3-sources\\.jar - /myapp/lib/test/junit-platform-commons-1\\.9\\.3\\.jar - /myapp/lib/test/junit-platform-console-standalone-1\\.9\\.3-sources\\.jar - /myapp/lib/test/junit-platform-console-standalone-1\\.9\\.3\\.jar - /myapp/lib/test/junit-platform-engine-1\\.9\\.3-sources\\.jar - /myapp/lib/test/junit-platform-engine-1\\.9\\.3\\.jar - /myapp/lib/test/opentest4j-1\\.2\\.0-sources\\.jar - /myapp/lib/test/opentest4j-1\\.2\\.0\\.jar + /myapp/lib/test/jsoup-1\\.16\\.2-sources\\.jar + /myapp/lib/test/jsoup-1\\.16\\.2\\.jar + /myapp/lib/test/junit-jupiter-5\\.10\\.0-sources\\.jar + /myapp/lib/test/junit-jupiter-5\\.10\\.0\\.jar + /myapp/lib/test/junit-jupiter-api-5\\.10\\.0-sources\\.jar + /myapp/lib/test/junit-jupiter-api-5\\.10\\.0\\.jar + /myapp/lib/test/junit-jupiter-engine-5\\.10\\.0-sources\\.jar + /myapp/lib/test/junit-jupiter-engine-5\\.10\\.0\\.jar + /myapp/lib/test/junit-jupiter-params-5\\.10\\.0-sources\\.jar + /myapp/lib/test/junit-jupiter-params-5\\.10\\.0\\.jar + /myapp/lib/test/junit-platform-commons-1\\.10\\.0-sources\\.jar + /myapp/lib/test/junit-platform-commons-1\\.10\\.0\\.jar + /myapp/lib/test/junit-platform-console-standalone-1\\.10\\.0-sources\\.jar + /myapp/lib/test/junit-platform-console-standalone-1\\.10\\.0\\.jar + /myapp/lib/test/junit-platform-engine-1\\.10\\.0-sources\\.jar + /myapp/lib/test/junit-platform-engine-1\\.10\\.0\\.jar + /myapp/lib/test/opentest4j-1\\.3\\.0-sources\\.jar + /myapp/lib/test/opentest4j-1\\.3\\.0\\.jar /myapp/src /myapp/src/bld /myapp/src/bld/java @@ -229,31 +229,31 @@ void testExecute() /myapp/lib/standalone/jetty-servlet-11\\.0\\.15\\.jar /myapp/lib/standalone/jetty-util-11\\.0\\.15-sources\\.jar /myapp/lib/standalone/jetty-util-11\\.0\\.15\\.jar - /myapp/lib/standalone/slf4j-api-2\\.0\\.7-sources\\.jar - /myapp/lib/standalone/slf4j-api-2\\.0\\.7\\.jar - /myapp/lib/standalone/slf4j-simple-2\\.0\\.7-sources\\.jar - /myapp/lib/standalone/slf4j-simple-2\\.0\\.7\\.jar + /myapp/lib/standalone/slf4j-api-2\\.0\\.9-sources\\.jar + /myapp/lib/standalone/slf4j-api-2\\.0\\.9\\.jar + /myapp/lib/standalone/slf4j-simple-2\\.0\\.9-sources\\.jar + /myapp/lib/standalone/slf4j-simple-2\\.0\\.9\\.jar /myapp/lib/test /myapp/lib/test/apiguardian-api-1\\.1\\.2-sources\\.jar /myapp/lib/test/apiguardian-api-1\\.1\\.2\\.jar - /myapp/lib/test/jsoup-1\\.16\\.1-sources\\.jar - /myapp/lib/test/jsoup-1\\.16\\.1\\.jar - /myapp/lib/test/junit-jupiter-5\\.9\\.3-sources\\.jar - /myapp/lib/test/junit-jupiter-5\\.9\\.3\\.jar - /myapp/lib/test/junit-jupiter-api-5\\.9\\.3-sources\\.jar - /myapp/lib/test/junit-jupiter-api-5\\.9\\.3\\.jar - /myapp/lib/test/junit-jupiter-engine-5\\.9\\.3-sources\\.jar - /myapp/lib/test/junit-jupiter-engine-5\\.9\\.3\\.jar - /myapp/lib/test/junit-jupiter-params-5\\.9\\.3-sources\\.jar - /myapp/lib/test/junit-jupiter-params-5\\.9\\.3\\.jar - /myapp/lib/test/junit-platform-commons-1\\.9\\.3-sources\\.jar - /myapp/lib/test/junit-platform-commons-1\\.9\\.3\\.jar - /myapp/lib/test/junit-platform-console-standalone-1\\.9\\.3-sources\\.jar - /myapp/lib/test/junit-platform-console-standalone-1\\.9\\.3\\.jar - /myapp/lib/test/junit-platform-engine-1\\.9\\.3-sources\\.jar - /myapp/lib/test/junit-platform-engine-1\\.9\\.3\\.jar - /myapp/lib/test/opentest4j-1\\.2\\.0-sources\\.jar - /myapp/lib/test/opentest4j-1\\.2\\.0\\.jar + /myapp/lib/test/jsoup-1\\.16\\.2-sources\\.jar + /myapp/lib/test/jsoup-1\\.16\\.2\\.jar + /myapp/lib/test/junit-jupiter-5\\.10\\.0-sources\\.jar + /myapp/lib/test/junit-jupiter-5\\.10\\.0\\.jar + /myapp/lib/test/junit-jupiter-api-5\\.10\\.0-sources\\.jar + /myapp/lib/test/junit-jupiter-api-5\\.10\\.0\\.jar + /myapp/lib/test/junit-jupiter-engine-5\\.10\\.0-sources\\.jar + /myapp/lib/test/junit-jupiter-engine-5\\.10\\.0\\.jar + /myapp/lib/test/junit-jupiter-params-5\\.10\\.0-sources\\.jar + /myapp/lib/test/junit-jupiter-params-5\\.10\\.0\\.jar + /myapp/lib/test/junit-platform-commons-1\\.10\\.0-sources\\.jar + /myapp/lib/test/junit-platform-commons-1\\.10\\.0\\.jar + /myapp/lib/test/junit-platform-console-standalone-1\\.10\\.0-sources\\.jar + /myapp/lib/test/junit-platform-console-standalone-1\\.10\\.0\\.jar + /myapp/lib/test/junit-platform-engine-1\\.10\\.0-sources\\.jar + /myapp/lib/test/junit-platform-engine-1\\.10\\.0\\.jar + /myapp/lib/test/opentest4j-1\\.3\\.0-sources\\.jar + /myapp/lib/test/opentest4j-1\\.3\\.0\\.jar /myapp/src /myapp/src/bld /myapp/src/bld/java @@ -478,30 +478,30 @@ void testExecuteLocalDependencies() /myapp/lib/local/jetty-servlet-11\\.0\\.15\\.jar /myapp/lib/local/jetty-util-11\\.0\\.15-sources\\.jar /myapp/lib/local/jetty-util-11\\.0\\.15\\.jar - /myapp/lib/local/jsoup-1\\.16\\.1-sources\\.jar - /myapp/lib/local/jsoup-1\\.16\\.1\\.jar - /myapp/lib/local/junit-jupiter-5\\.9\\.3-sources\\.jar - /myapp/lib/local/junit-jupiter-5\\.9\\.3\\.jar - /myapp/lib/local/junit-jupiter-api-5\\.9\\.3-sources\\.jar - /myapp/lib/local/junit-jupiter-api-5\\.9\\.3\\.jar - /myapp/lib/local/junit-jupiter-engine-5\\.9\\.3-sources\\.jar - /myapp/lib/local/junit-jupiter-engine-5\\.9\\.3\\.jar - /myapp/lib/local/junit-jupiter-params-5\\.9\\.3-sources\\.jar - /myapp/lib/local/junit-jupiter-params-5\\.9\\.3\\.jar - /myapp/lib/local/junit-platform-commons-1\\.9\\.3-sources\\.jar - /myapp/lib/local/junit-platform-commons-1\\.9\\.3\\.jar - /myapp/lib/local/junit-platform-console-standalone-1\\.9\\.3-sources\\.jar - /myapp/lib/local/junit-platform-console-standalone-1\\.9\\.3\\.jar - /myapp/lib/local/junit-platform-engine-1\\.9\\.3-sources\\.jar - /myapp/lib/local/junit-platform-engine-1\\.9\\.3\\.jar - /myapp/lib/local/opentest4j-1\\.2\\.0-sources\\.jar - /myapp/lib/local/opentest4j-1\\.2\\.0\\.jar + /myapp/lib/local/jsoup-1\\.16\\.2-sources\\.jar + /myapp/lib/local/jsoup-1\\.16\\.2\\.jar + /myapp/lib/local/junit-jupiter-5\\.10\\.0-sources\\.jar + /myapp/lib/local/junit-jupiter-5\\.10\\.0\\.jar + /myapp/lib/local/junit-jupiter-api-5\\.10\\.0-sources\\.jar + /myapp/lib/local/junit-jupiter-api-5\\.10\\.0\\.jar + /myapp/lib/local/junit-jupiter-engine-5\\.10\\.0-sources\\.jar + /myapp/lib/local/junit-jupiter-engine-5\\.10\\.0\\.jar + /myapp/lib/local/junit-jupiter-params-5\\.10\\.0-sources\\.jar + /myapp/lib/local/junit-jupiter-params-5\\.10\\.0\\.jar + /myapp/lib/local/junit-platform-commons-1\\.10\\.0-sources\\.jar + /myapp/lib/local/junit-platform-commons-1\\.10\\.0\\.jar + /myapp/lib/local/junit-platform-console-standalone-1\\.10\\.0-sources\\.jar + /myapp/lib/local/junit-platform-console-standalone-1\\.10\\.0\\.jar + /myapp/lib/local/junit-platform-engine-1\\.10\\.0-sources\\.jar + /myapp/lib/local/junit-platform-engine-1\\.10\\.0\\.jar + /myapp/lib/local/opentest4j-1\\.3\\.0-sources\\.jar + /myapp/lib/local/opentest4j-1\\.3\\.0\\.jar /myapp/lib/local/rife2-.*-sources\\.jar /myapp/lib/local/rife2-.*\\.jar - /myapp/lib/local/slf4j-api-2\\.0\\.7-sources\\.jar - /myapp/lib/local/slf4j-api-2\\.0\\.7\\.jar - /myapp/lib/local/slf4j-simple-2\\.0\\.7-sources\\.jar - /myapp/lib/local/slf4j-simple-2\\.0\\.7\\.jar + /myapp/lib/local/slf4j-api-2\\.0\\.9-sources\\.jar + /myapp/lib/local/slf4j-api-2\\.0\\.9\\.jar + /myapp/lib/local/slf4j-simple-2\\.0\\.9-sources\\.jar + /myapp/lib/local/slf4j-simple-2\\.0\\.9\\.jar /myapp/lib/runtime /myapp/lib/standalone /myapp/lib/test @@ -644,31 +644,31 @@ void testExecuteLocalDependenciesFolders() /myapp/lib/local_standalone/jetty-servlet-11\\.0\\.15\\.jar /myapp/lib/local_standalone/jetty-util-11\\.0\\.15-sources\\.jar /myapp/lib/local_standalone/jetty-util-11\\.0\\.15\\.jar - /myapp/lib/local_standalone/slf4j-api-2\\.0\\.7-sources\\.jar - /myapp/lib/local_standalone/slf4j-api-2\\.0\\.7\\.jar - /myapp/lib/local_standalone/slf4j-simple-2\\.0\\.7-sources\\.jar - /myapp/lib/local_standalone/slf4j-simple-2\\.0\\.7\\.jar + /myapp/lib/local_standalone/slf4j-api-2\\.0\\.9-sources\\.jar + /myapp/lib/local_standalone/slf4j-api-2\\.0\\.9\\.jar + /myapp/lib/local_standalone/slf4j-simple-2\\.0\\.9-sources\\.jar + /myapp/lib/local_standalone/slf4j-simple-2\\.0\\.9\\.jar /myapp/lib/local_test /myapp/lib/local_test/apiguardian-api-1\\.1\\.2-sources\\.jar /myapp/lib/local_test/apiguardian-api-1\\.1\\.2\\.jar - /myapp/lib/local_test/jsoup-1\\.16\\.1-sources\\.jar - /myapp/lib/local_test/jsoup-1\\.16\\.1\\.jar - /myapp/lib/local_test/junit-jupiter-5\\.9\\.3-sources\\.jar - /myapp/lib/local_test/junit-jupiter-5\\.9\\.3\\.jar - /myapp/lib/local_test/junit-jupiter-api-5\\.9\\.3-sources\\.jar - /myapp/lib/local_test/junit-jupiter-api-5\\.9\\.3\\.jar - /myapp/lib/local_test/junit-jupiter-engine-5\\.9\\.3-sources\\.jar - /myapp/lib/local_test/junit-jupiter-engine-5\\.9\\.3\\.jar - /myapp/lib/local_test/junit-jupiter-params-5\\.9\\.3-sources\\.jar - /myapp/lib/local_test/junit-jupiter-params-5\\.9\\.3\\.jar - /myapp/lib/local_test/junit-platform-commons-1\\.9\\.3-sources\\.jar - /myapp/lib/local_test/junit-platform-commons-1\\.9\\.3\\.jar - /myapp/lib/local_test/junit-platform-console-standalone-1\\.9\\.3-sources\\.jar - /myapp/lib/local_test/junit-platform-console-standalone-1\\.9\\.3\\.jar - /myapp/lib/local_test/junit-platform-engine-1\\.9\\.3-sources\\.jar - /myapp/lib/local_test/junit-platform-engine-1\\.9\\.3\\.jar - /myapp/lib/local_test/opentest4j-1\\.2\\.0-sources\\.jar - /myapp/lib/local_test/opentest4j-1\\.2\\.0\\.jar + /myapp/lib/local_test/jsoup-1\\.16\\.2-sources\\.jar + /myapp/lib/local_test/jsoup-1\\.16\\.2\\.jar + /myapp/lib/local_test/junit-jupiter-5\\.10\\.0-sources\\.jar + /myapp/lib/local_test/junit-jupiter-5\\.10\\.0\\.jar + /myapp/lib/local_test/junit-jupiter-api-5\\.10\\.0-sources\\.jar + /myapp/lib/local_test/junit-jupiter-api-5\\.10\\.0\\.jar + /myapp/lib/local_test/junit-jupiter-engine-5\\.10\\.0-sources\\.jar + /myapp/lib/local_test/junit-jupiter-engine-5\\.10\\.0\\.jar + /myapp/lib/local_test/junit-jupiter-params-5\\.10\\.0-sources\\.jar + /myapp/lib/local_test/junit-jupiter-params-5\\.10\\.0\\.jar + /myapp/lib/local_test/junit-platform-commons-1\\.10\\.0-sources\\.jar + /myapp/lib/local_test/junit-platform-commons-1\\.10\\.0\\.jar + /myapp/lib/local_test/junit-platform-console-standalone-1\\.10\\.0-sources\\.jar + /myapp/lib/local_test/junit-platform-console-standalone-1\\.10\\.0\\.jar + /myapp/lib/local_test/junit-platform-engine-1\\.10\\.0-sources\\.jar + /myapp/lib/local_test/junit-platform-engine-1\\.10\\.0\\.jar + /myapp/lib/local_test/opentest4j-1\\.3\\.0-sources\\.jar + /myapp/lib/local_test/opentest4j-1\\.3\\.0\\.jar /myapp/lib/runtime /myapp/lib/standalone /myapp/lib/test diff --git a/src/test/java/rife/bld/operations/TestJUnitOperation.java b/src/test/java/rife/bld/operations/TestJUnitOperation.java index e837f4a..4b6436c 100644 --- a/src/test/java/rife/bld/operations/TestJUnitOperation.java +++ b/src/test/java/rife/bld/operations/TestJUnitOperation.java @@ -5,6 +5,8 @@ package rife.bld.operations; import org.junit.jupiter.api.Test; +import rife.bld.Project; +import rife.bld.dependencies.Scope; import rife.tools.FileUtils; import rife.tools.StringUtils; @@ -14,6 +16,7 @@ import java.util.function.Function; import static org.junit.jupiter.api.Assertions.*; +import static rife.bld.dependencies.Scope.test; public class TestJUnitOperation { @Test @@ -210,4 +213,58 @@ void testFromProject() FileUtils.deleteDirectory(tmp); } } + + @Test + void testFromOldProject() + throws Exception { + var tmp = Files.createTempDirectory("test").toFile(); + try { + var create_operation = new CreateBlankOperation() { + @Override + protected Project createProjectBlueprint() { + var project = super.createProjectBlueprint(); + project.scope(Scope.test).clear(); + project.scope(Scope.test) + .include(project.dependency("org.junit.jupiter", "junit-jupiter", project.version(5,9,3))) + .include(project.dependency("org.junit.platform", "junit-platform-console-standalone", project.version(1,9,3))); + return project; + } + } + .workDirectory(tmp) + .packageName("com.example") + .projectName("myapp") + .downloadDependencies(true); + + create_operation.execute(); + + new CompileOperation() + .fromProject(create_operation.project()).execute(); + + var check_result = new StringBuilder(); + new JUnitOperation() + .fromProject(create_operation.project()) + .outputProcessor(s -> { + check_result.append(s).append(System.lineSeparator()); + return true; + }) + .execute(); + assertTrue(check_result.toString().contains(StringUtils.convertLineSeparator(""" + [ 2 containers found ] + [ 0 containers skipped ] + [ 2 containers started ] + [ 0 containers aborted ] + [ 2 containers successful ] + [ 0 containers failed ] + [ 1 tests found ] + [ 0 tests skipped ] + [ 1 tests started ] + [ 0 tests aborted ] + [ 1 tests successful ] + [ 0 tests failed ] + """))); + + } finally { + FileUtils.deleteDirectory(tmp); + } + } }