This is an automated email from the ASF dual-hosted git repository. tibordigana pushed a commit to branch SUREFIRE-1733 in repository https://gitbox.apache.org/repos/asf/maven-surefire.git
commit c8eeeff5cb71e68b729914f54a19530260f230a2 Author: tibordigana <[email protected]> AuthorDate: Fri May 29 02:40:38 2020 +0200 ITs for the TestNG, JUnit4 and JUnit5 --- .../surefire/its/jiras/Surefire1733JUnitIT.java | 53 +++++++++++ .../surefire/its/jiras/Surefire1733TestngIT.java | 53 +++++++++++ .../com.foo.impl/src/test/java/module-info.java | 8 +- .../src/test/java/module-info.java | 2 +- .../test/resources/surefire-1733-junit4/pom.xml | 102 +++++++++++++++++++++ .../src/main/java/main/Service.java} | 10 +- .../src/main}/java/module-info.java | 9 +- .../src/test/java/module-info.java | 12 ++- .../src/test/java/test/MyIT.java} | 34 +++++-- .../src/test/java/test/MyTest.java} | 34 +++++-- .../test/resources/surefire-1733-testng/pom.xml | 102 +++++++++++++++++++++ .../src/main/java/main/Service.java} | 10 +- .../src/main}/java/module-info.java | 9 +- .../src/test/java/module-info.java | 13 ++- .../src/test/java/test/MyIT.java} | 34 +++++-- .../src/test/java/test/MyTest.java} | 35 +++++-- 16 files changed, 449 insertions(+), 71 deletions(-) diff --git a/surefire-its/src/test/java/org/apache/maven/surefire/its/jiras/Surefire1733JUnitIT.java b/surefire-its/src/test/java/org/apache/maven/surefire/its/jiras/Surefire1733JUnitIT.java new file mode 100644 index 0000000..242fede --- /dev/null +++ b/surefire-its/src/test/java/org/apache/maven/surefire/its/jiras/Surefire1733JUnitIT.java @@ -0,0 +1,53 @@ +package org.apache.maven.surefire.its.jiras; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import org.apache.maven.surefire.its.AbstractJigsawIT; +import org.junit.Test; + +import static org.hamcrest.Matchers.containsString; +import static org.hamcrest.Matchers.is; + +/** + * Integration test for <a href="https://issues.apache.org/jira/browse/SUREFIRE-1733">SUREFIRE-1733</a>. + */ +public class Surefire1733JUnitIT extends AbstractJigsawIT +{ + @Test + public void test() throws Exception + { + assumeJava9() + .debugLogging() + .executeVerify() + .assertTestSuiteResults( 1, 0, 0, 0 ) + .assertIntegrationTestSuiteResults( 1, 0, 0, 0 ) + .assertThatLogLine( containsString( "Running test.MyTest" ), is( 1 ) ) + .assertThatLogLine( containsString( "Running test.MyIT" ), is( 1 ) ) + .assertThatLogLine( containsString( "class main.Service in the module \"main\"" ), is( 2 ) ) + .assertThatLogLine( containsString( "class test.MyTest in the module \"test\"" ), is( 1 ) ) + .assertThatLogLine( containsString( "class test.MyIT in the module \"test\"" ), is( 1 ) ); + } + + @Override + protected String getProjectDirectoryName() + { + return "surefire-1733-junit4"; + } +} diff --git a/surefire-its/src/test/java/org/apache/maven/surefire/its/jiras/Surefire1733TestngIT.java b/surefire-its/src/test/java/org/apache/maven/surefire/its/jiras/Surefire1733TestngIT.java new file mode 100644 index 0000000..53210c7 --- /dev/null +++ b/surefire-its/src/test/java/org/apache/maven/surefire/its/jiras/Surefire1733TestngIT.java @@ -0,0 +1,53 @@ +package org.apache.maven.surefire.its.jiras; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import org.apache.maven.surefire.its.AbstractJigsawIT; +import org.junit.Test; + +import static org.hamcrest.Matchers.containsString; +import static org.hamcrest.Matchers.is; + +/** + * Integration test for <a href="https://issues.apache.org/jira/browse/SUREFIRE-1733">SUREFIRE-1733</a>. + */ +public class Surefire1733TestngIT extends AbstractJigsawIT +{ + @Test + public void test() throws Exception + { + assumeJava9() + .debugLogging() + .executeVerify() + .assertTestSuiteResults( 1, 0, 0, 0 ) + .assertIntegrationTestSuiteResults( 1, 0, 0, 0 ) + .assertThatLogLine( containsString( "Running test.MyTest" ), is( 1 ) ) + .assertThatLogLine( containsString( "Running test.MyIT" ), is( 1 ) ) + .assertThatLogLine( containsString( "class main.Service in the module \"main\"" ), is( 2 ) ) + .assertThatLogLine( containsString( "class test.MyTest in the module \"test\"" ), is( 1 ) ) + .assertThatLogLine( containsString( "class test.MyIT in the module \"test\"" ), is( 1 ) ); + } + + @Override + protected String getProjectDirectoryName() + { + return "surefire-1733-testng"; + } +} diff --git a/surefire-its/src/test/resources/maven-multimodule-project-with-jpms/com.foo.impl/src/test/java/module-info.java b/surefire-its/src/test/resources/maven-multimodule-project-with-jpms/com.foo.impl/src/test/java/module-info.java index 60ba2dc..06000d0 100644 --- a/surefire-its/src/test/resources/maven-multimodule-project-with-jpms/com.foo.impl/src/test/java/module-info.java +++ b/surefire-its/src/test/resources/maven-multimodule-project-with-jpms/com.foo.impl/src/test/java/module-info.java @@ -22,10 +22,6 @@ open module com.foo.test requires com.foo.impl; requires org.slf4j; requires org.slf4j.simple; - //requires org.junit.platform.launcher; - requires org.junit.jupiter.engine; - requires org.junit.jupiter.api; - requires org.apiguardian.api; - //requires org.junit.platform.commons; - requires org.opentest4j; + requires transitive org.junit.jupiter.engine; + requires transitive org.junit.jupiter.api; } diff --git a/surefire-its/src/test/resources/surefire-1712-extracted-modulename-without-asm/src/test/java/module-info.java b/surefire-its/src/test/resources/surefire-1712-extracted-modulename-without-asm/src/test/java/module-info.java index 5a9f6d3..5291a22 100644 --- a/surefire-its/src/test/resources/surefire-1712-extracted-modulename-without-asm/src/test/java/module-info.java +++ b/surefire-its/src/test/resources/surefire-1712-extracted-modulename-without-asm/src/test/java/module-info.java @@ -20,6 +20,6 @@ open module wtf.g4s8.oot.test { requires wtf.g4s8.oot; - requires org.junit.jupiter.api; + requires transitive org.junit.jupiter.engine; requires transitive org.hamcrest; } diff --git a/surefire-its/src/test/resources/surefire-1733-junit4/pom.xml b/surefire-its/src/test/resources/surefire-1733-junit4/pom.xml new file mode 100644 index 0000000..c309b7f --- /dev/null +++ b/surefire-its/src/test/resources/surefire-1733-junit4/pom.xml @@ -0,0 +1,102 @@ +<?xml version="1.0" encoding="UTF-8"?> + +<!-- + ~ Licensed to the Apache Software Foundation (ASF) under one + ~ or more contributor license agreements. See the NOTICE file + ~ distributed with this work for additional information + ~ regarding copyright ownership. The ASF licenses this file + ~ to you under the Apache License, Version 2.0 (the + ~ "License"); you may not use this file except in compliance + ~ with the License. You may obtain a copy of the License at + ~ + ~ http://www.apache.org/licenses/LICENSE-2.0 + ~ + ~ Unless required by applicable law or agreed to in writing, + ~ software distributed under the License is distributed on an + ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + ~ KIND, either express or implied. See the License for the + ~ specific language governing permissions and limitations + ~ under the License. + --> +<project xmlns="http://maven.apache.org/POM/4.0.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + + <groupId>org.example</groupId> + <artifactId>surefire-1733-junit4</artifactId> + <version>1.0-SNAPSHOT</version> + + <properties> + <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> + <maven.compiler.release>${java.specification.version}</maven.compiler.release> + </properties> + + <dependencies> + <dependency> + <groupId>junit</groupId> + <artifactId>junit</artifactId> + <version>4.13</version> + <scope>test</scope> + <exclusions> + <exclusion> + <groupId>org.hamcrest</groupId> + <artifactId>hamcrest-core</artifactId> + </exclusion> + </exclusions> + </dependency> + <dependency> + <groupId>org.hamcrest</groupId> + <artifactId>hamcrest</artifactId> + <version>2.2</version> + <scope>test</scope> + </dependency> + </dependencies> + + <build> + <pluginManagement> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-compiler-plugin</artifactId> + <version>3.8.1</version> + </plugin> + </plugins> + </pluginManagement> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-surefire-plugin</artifactId> + <version>${surefire.version}</version> + <configuration> + <test>MyTest</test> + </configuration> + </plugin> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-failsafe-plugin</artifactId> + <version>${surefire.version}</version> + <executions> + <execution> + <id>it</id> + <phase>integration-test</phase> + <goals> + <goal>integration-test</goal> + </goals> + <configuration> + <test>MyIT</test> + </configuration> + </execution> + <execution> + <id>verify</id> + <phase>verify</phase> + <goals> + <goal>verify</goal> + </goals> + </execution> + </executions> + </plugin> + </plugins> + </build> + +</project> diff --git a/surefire-its/src/test/resources/surefire-1712-extracted-modulename-without-asm/src/test/java/module-info.java b/surefire-its/src/test/resources/surefire-1733-junit4/src/main/java/main/Service.java similarity index 86% copy from surefire-its/src/test/resources/surefire-1712-extracted-modulename-without-asm/src/test/java/module-info.java copy to surefire-its/src/test/resources/surefire-1733-junit4/src/main/java/main/Service.java index 5a9f6d3..68592db 100644 --- a/surefire-its/src/test/resources/surefire-1712-extracted-modulename-without-asm/src/test/java/module-info.java +++ b/surefire-its/src/test/resources/surefire-1733-junit4/src/main/java/main/Service.java @@ -1,3 +1,5 @@ +package main; + /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -17,9 +19,9 @@ * under the License. */ -open module wtf.g4s8.oot.test +/** + * + */ +public class Service { - requires wtf.g4s8.oot; - requires org.junit.jupiter.api; - requires transitive org.hamcrest; } diff --git a/surefire-its/src/test/resources/surefire-1712-extracted-modulename-without-asm/src/test/java/module-info.java b/surefire-its/src/test/resources/surefire-1733-junit4/src/main/java/module-info.java similarity index 86% copy from surefire-its/src/test/resources/surefire-1712-extracted-modulename-without-asm/src/test/java/module-info.java copy to surefire-its/src/test/resources/surefire-1733-junit4/src/main/java/module-info.java index 5a9f6d3..216ec8a 100644 --- a/surefire-its/src/test/resources/surefire-1712-extracted-modulename-without-asm/src/test/java/module-info.java +++ b/surefire-its/src/test/resources/surefire-1733-junit4/src/main/java/module-info.java @@ -17,9 +17,10 @@ * under the License. */ -open module wtf.g4s8.oot.test +/** + * + */ +module main { - requires wtf.g4s8.oot; - requires org.junit.jupiter.api; - requires transitive org.hamcrest; + exports main; } diff --git a/surefire-its/src/test/resources/surefire-1712-extracted-modulename-without-asm/src/test/java/module-info.java b/surefire-its/src/test/resources/surefire-1733-junit4/src/test/java/module-info.java similarity index 86% copy from surefire-its/src/test/resources/surefire-1712-extracted-modulename-without-asm/src/test/java/module-info.java copy to surefire-its/src/test/resources/surefire-1733-junit4/src/test/java/module-info.java index 5a9f6d3..4334908 100644 --- a/surefire-its/src/test/resources/surefire-1712-extracted-modulename-without-asm/src/test/java/module-info.java +++ b/surefire-its/src/test/resources/surefire-1733-junit4/src/test/java/module-info.java @@ -17,9 +17,13 @@ * under the License. */ -open module wtf.g4s8.oot.test +/** + * + */ +/*open*/ module test { - requires wtf.g4s8.oot; - requires org.junit.jupiter.api; - requires transitive org.hamcrest; + requires main; + requires junit; + requires org.hamcrest; + exports test to junit; } diff --git a/surefire-its/src/test/resources/maven-multimodule-project-with-jpms/com.foo.impl/src/test/java/module-info.java b/surefire-its/src/test/resources/surefire-1733-junit4/src/test/java/test/MyIT.java similarity index 54% copy from surefire-its/src/test/resources/maven-multimodule-project-with-jpms/com.foo.impl/src/test/java/module-info.java copy to surefire-its/src/test/resources/surefire-1733-junit4/src/test/java/test/MyIT.java index 60ba2dc..3e3eb52 100644 --- a/surefire-its/src/test/resources/maven-multimodule-project-with-jpms/com.foo.impl/src/test/java/module-info.java +++ b/surefire-its/src/test/resources/surefire-1733-junit4/src/test/java/test/MyIT.java @@ -1,3 +1,5 @@ +package test; + /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -17,15 +19,27 @@ * under the License. */ -open module com.foo.test +import main.Service; +import org.junit.Test; + +import static org.hamcrest.MatcherAssert.assertThat; +import static org.hamcrest.Matchers.is; + +/** + * + */ +public class MyIT { - requires com.foo.impl; - requires org.slf4j; - requires org.slf4j.simple; - //requires org.junit.platform.launcher; - requires org.junit.jupiter.engine; - requires org.junit.jupiter.api; - requires org.apiguardian.api; - //requires org.junit.platform.commons; - requires org.opentest4j; + @Test + public void test() + { + Service service = new Service(); + String moduleName = service.getClass().getModule().getName(); + System.out.println( service.getClass() + " in the module \"" + moduleName + "\"" ); + assertThat( moduleName, is( "main" ) ); + + moduleName = getClass().getModule().getName(); + System.out.println( getClass() + " in the module \"" + moduleName + "\"" ); + assertThat( moduleName, is( "test" ) ); + } } diff --git a/surefire-its/src/test/resources/maven-multimodule-project-with-jpms/com.foo.impl/src/test/java/module-info.java b/surefire-its/src/test/resources/surefire-1733-junit4/src/test/java/test/MyTest.java similarity index 54% copy from surefire-its/src/test/resources/maven-multimodule-project-with-jpms/com.foo.impl/src/test/java/module-info.java copy to surefire-its/src/test/resources/surefire-1733-junit4/src/test/java/test/MyTest.java index 60ba2dc..c839350 100644 --- a/surefire-its/src/test/resources/maven-multimodule-project-with-jpms/com.foo.impl/src/test/java/module-info.java +++ b/surefire-its/src/test/resources/surefire-1733-junit4/src/test/java/test/MyTest.java @@ -1,3 +1,5 @@ +package test; + /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -17,15 +19,27 @@ * under the License. */ -open module com.foo.test +import main.Service; +import org.junit.Test; + +import static org.hamcrest.MatcherAssert.assertThat; +import static org.hamcrest.Matchers.is; + +/** + * + */ +public class MyTest { - requires com.foo.impl; - requires org.slf4j; - requires org.slf4j.simple; - //requires org.junit.platform.launcher; - requires org.junit.jupiter.engine; - requires org.junit.jupiter.api; - requires org.apiguardian.api; - //requires org.junit.platform.commons; - requires org.opentest4j; + @Test + public void test() + { + Service service = new Service(); + String moduleName = service.getClass().getModule().getName(); + System.out.println( service.getClass() + " in the module \"" + moduleName + "\"" ); + assertThat( moduleName, is( "main" ) ); + + moduleName = getClass().getModule().getName(); + System.out.println( getClass() + " in the module \"" + moduleName + "\"" ); + assertThat( moduleName, is( "test" ) ); + } } diff --git a/surefire-its/src/test/resources/surefire-1733-testng/pom.xml b/surefire-its/src/test/resources/surefire-1733-testng/pom.xml new file mode 100644 index 0000000..630d09d --- /dev/null +++ b/surefire-its/src/test/resources/surefire-1733-testng/pom.xml @@ -0,0 +1,102 @@ +<?xml version="1.0" encoding="UTF-8"?> + +<!-- + ~ Licensed to the Apache Software Foundation (ASF) under one + ~ or more contributor license agreements. See the NOTICE file + ~ distributed with this work for additional information + ~ regarding copyright ownership. The ASF licenses this file + ~ to you under the Apache License, Version 2.0 (the + ~ "License"); you may not use this file except in compliance + ~ with the License. You may obtain a copy of the License at + ~ + ~ http://www.apache.org/licenses/LICENSE-2.0 + ~ + ~ Unless required by applicable law or agreed to in writing, + ~ software distributed under the License is distributed on an + ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + ~ KIND, either express or implied. See the License for the + ~ specific language governing permissions and limitations + ~ under the License. + --> +<project xmlns="http://maven.apache.org/POM/4.0.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + + <groupId>org.example</groupId> + <artifactId>surefire-1733-testng</artifactId> + <version>1.0-SNAPSHOT</version> + + <properties> + <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> + <maven.compiler.release>${java.specification.version}</maven.compiler.release> + </properties> + + <dependencies> + <dependency> + <groupId>org.testng</groupId> + <artifactId>testng</artifactId> + <version>7.1.0</version> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.hamcrest</groupId> + <artifactId>hamcrest</artifactId> + <version>2.2</version> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.assertj</groupId> + <artifactId>assertj-core</artifactId> + <version>3.16.1</version> + <scope>test</scope> + </dependency> + </dependencies> + + <build> + <pluginManagement> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-compiler-plugin</artifactId> + <version>3.8.1</version> + </plugin> + </plugins> + </pluginManagement> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-surefire-plugin</artifactId> + <version>${surefire.version}</version> + <configuration> + <test>MyTest</test> + </configuration> + </plugin> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-failsafe-plugin</artifactId> + <version>${surefire.version}</version> + <executions> + <execution> + <id>it</id> + <phase>integration-test</phase> + <goals> + <goal>integration-test</goal> + </goals> + <configuration> + <test>MyIT</test> + </configuration> + </execution> + <execution> + <id>verify</id> + <phase>verify</phase> + <goals> + <goal>verify</goal> + </goals> + </execution> + </executions> + </plugin> + </plugins> + </build> + +</project> diff --git a/surefire-its/src/test/resources/surefire-1712-extracted-modulename-without-asm/src/test/java/module-info.java b/surefire-its/src/test/resources/surefire-1733-testng/src/main/java/main/Service.java similarity index 86% copy from surefire-its/src/test/resources/surefire-1712-extracted-modulename-without-asm/src/test/java/module-info.java copy to surefire-its/src/test/resources/surefire-1733-testng/src/main/java/main/Service.java index 5a9f6d3..68592db 100644 --- a/surefire-its/src/test/resources/surefire-1712-extracted-modulename-without-asm/src/test/java/module-info.java +++ b/surefire-its/src/test/resources/surefire-1733-testng/src/main/java/main/Service.java @@ -1,3 +1,5 @@ +package main; + /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -17,9 +19,9 @@ * under the License. */ -open module wtf.g4s8.oot.test +/** + * + */ +public class Service { - requires wtf.g4s8.oot; - requires org.junit.jupiter.api; - requires transitive org.hamcrest; } diff --git a/surefire-its/src/test/resources/surefire-1712-extracted-modulename-without-asm/src/test/java/module-info.java b/surefire-its/src/test/resources/surefire-1733-testng/src/main/java/module-info.java similarity index 86% copy from surefire-its/src/test/resources/surefire-1712-extracted-modulename-without-asm/src/test/java/module-info.java copy to surefire-its/src/test/resources/surefire-1733-testng/src/main/java/module-info.java index 5a9f6d3..216ec8a 100644 --- a/surefire-its/src/test/resources/surefire-1712-extracted-modulename-without-asm/src/test/java/module-info.java +++ b/surefire-its/src/test/resources/surefire-1733-testng/src/main/java/module-info.java @@ -17,9 +17,10 @@ * under the License. */ -open module wtf.g4s8.oot.test +/** + * + */ +module main { - requires wtf.g4s8.oot; - requires org.junit.jupiter.api; - requires transitive org.hamcrest; + exports main; } diff --git a/surefire-its/src/test/resources/surefire-1712-extracted-modulename-without-asm/src/test/java/module-info.java b/surefire-its/src/test/resources/surefire-1733-testng/src/test/java/module-info.java similarity index 83% copy from surefire-its/src/test/resources/surefire-1712-extracted-modulename-without-asm/src/test/java/module-info.java copy to surefire-its/src/test/resources/surefire-1733-testng/src/test/java/module-info.java index 5a9f6d3..8b1ec9c 100644 --- a/surefire-its/src/test/resources/surefire-1712-extracted-modulename-without-asm/src/test/java/module-info.java +++ b/surefire-its/src/test/resources/surefire-1733-testng/src/test/java/module-info.java @@ -17,9 +17,14 @@ * under the License. */ -open module wtf.g4s8.oot.test +/** + * + */ +/*open*/ module test { - requires wtf.g4s8.oot; - requires org.junit.jupiter.api; - requires transitive org.hamcrest; + requires main; + requires org.testng; + requires org.hamcrest; + requires org.assertj.core; + exports test to org.testng; } diff --git a/surefire-its/src/test/resources/maven-multimodule-project-with-jpms/com.foo.impl/src/test/java/module-info.java b/surefire-its/src/test/resources/surefire-1733-testng/src/test/java/test/MyIT.java similarity index 54% copy from surefire-its/src/test/resources/maven-multimodule-project-with-jpms/com.foo.impl/src/test/java/module-info.java copy to surefire-its/src/test/resources/surefire-1733-testng/src/test/java/test/MyIT.java index 60ba2dc..534672d 100644 --- a/surefire-its/src/test/resources/maven-multimodule-project-with-jpms/com.foo.impl/src/test/java/module-info.java +++ b/surefire-its/src/test/resources/surefire-1733-testng/src/test/java/test/MyIT.java @@ -1,3 +1,5 @@ +package test; + /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -17,15 +19,27 @@ * under the License. */ -open module com.foo.test +import main.Service; +import org.testng.annotations.Test; + +import static org.hamcrest.MatcherAssert.assertThat; +import static org.hamcrest.Matchers.is; + +/** + * + */ +public class MyIT { - requires com.foo.impl; - requires org.slf4j; - requires org.slf4j.simple; - //requires org.junit.platform.launcher; - requires org.junit.jupiter.engine; - requires org.junit.jupiter.api; - requires org.apiguardian.api; - //requires org.junit.platform.commons; - requires org.opentest4j; + @Test + public void test() + { + Service service = new Service(); + String moduleName = service.getClass().getModule().getName(); + System.out.println( service.getClass() + " in the module \"" + moduleName + "\"" ); + assertThat( moduleName, is( "main" ) ); + + moduleName = getClass().getModule().getName(); + System.out.println( getClass() + " in the module \"" + moduleName + "\"" ); + assertThat( moduleName, is( "test" ) ); + } } diff --git a/surefire-its/src/test/resources/maven-multimodule-project-with-jpms/com.foo.impl/src/test/java/module-info.java b/surefire-its/src/test/resources/surefire-1733-testng/src/test/java/test/MyTest.java similarity index 54% copy from surefire-its/src/test/resources/maven-multimodule-project-with-jpms/com.foo.impl/src/test/java/module-info.java copy to surefire-its/src/test/resources/surefire-1733-testng/src/test/java/test/MyTest.java index 60ba2dc..c13d1f1 100644 --- a/surefire-its/src/test/resources/maven-multimodule-project-with-jpms/com.foo.impl/src/test/java/module-info.java +++ b/surefire-its/src/test/resources/surefire-1733-testng/src/test/java/test/MyTest.java @@ -1,3 +1,5 @@ +package test; + /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -17,15 +19,28 @@ * under the License. */ -open module com.foo.test +import main.Service; +import org.testng.annotations.Test; + +import static org.assertj.core.api.Assertions.assertThat; + +/** + * + */ +public class MyTest { - requires com.foo.impl; - requires org.slf4j; - requires org.slf4j.simple; - //requires org.junit.platform.launcher; - requires org.junit.jupiter.engine; - requires org.junit.jupiter.api; - requires org.apiguardian.api; - //requires org.junit.platform.commons; - requires org.opentest4j; + @Test + public void test() + { + Service service = new Service(); + String moduleName = service.getClass().getModule().getName(); + System.out.println( service.getClass() + " in the module \"" + moduleName + "\"" ); + assertThat( moduleName ) + .isEqualTo( "main" ); + + moduleName = getClass().getModule().getName(); + System.out.println( getClass() + " in the module \"" + moduleName + "\"" ); + assertThat( moduleName ) + .isEqualTo( "test" ); + } }
