From 27ae6c1672c5e7249fd3171df095b5015246e12c Mon Sep 17 00:00:00 2001 From: Nils Renaud Date: Tue, 8 Feb 2022 17:49:35 +0100 Subject: [PATCH 1/3] SUREFIRE-1909 Replace --add-exports with --add-opens Signed-off-by: Nils Renaud --- .../booterclient/ModularClasspathForkConfiguration.java | 2 +- .../booterclient/ModularClasspathForkConfigurationTest.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/booterclient/ModularClasspathForkConfiguration.java b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/booterclient/ModularClasspathForkConfiguration.java index 8d4d84c68f..fc89016b5b 100644 --- a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/booterclient/ModularClasspathForkConfiguration.java +++ b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/booterclient/ModularClasspathForkConfiguration.java @@ -183,7 +183,7 @@ File createArgsFile( @Nonnull String moduleName, @Nonnull List modulePat for ( String pkg : packages ) { - args.append( "--add-exports" ) + args.append( "--add-opens" ) .append( NL ) .append( moduleName ) .append( '/' ) diff --git a/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/booterclient/ModularClasspathForkConfigurationTest.java b/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/booterclient/ModularClasspathForkConfigurationTest.java index 9a40a10689..14ea5623cd 100644 --- a/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/booterclient/ModularClasspathForkConfigurationTest.java +++ b/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/booterclient/ModularClasspathForkConfigurationTest.java @@ -116,7 +116,7 @@ public void shouldCreateModularArgsFile() throws Exception .isEqualTo( "abc=\"" + replace( patchFile.getPath(), "\\", "\\\\" ) + "\"" ); assertThat( argsFileLines.get( 6 ) ) - .isEqualTo( "--add-exports" ); + .isEqualTo( "--add-opens" ); assertThat( argsFileLines.get( 7 ) ) .isEqualTo( "abc/org.apache.abc=ALL-UNNAMED" ); From bc4ba50813efa6aed394eaa82109ea92384319dd Mon Sep 17 00:00:00 2001 From: Nils Renaud Date: Wed, 9 Feb 2022 12:41:26 +0100 Subject: [PATCH 2/3] SUREFIRE-1909 permit to set the Jpms test openness mode Signed-off-by: Nils Renaud --- .../plugin/failsafe/IntegrationTestMojo.java | 21 +++++++++ .../plugin/surefire/AbstractSurefireMojo.java | 32 ++++++++----- .../ModularClasspathForkConfiguration.java | 8 +++- .../AbstractSurefireMojoJava7PlusTest.java | 12 +++++ .../surefire/AbstractSurefireMojoTest.java | 13 +++++ .../plugin/surefire/MojoMocklessTest.java | 12 +++++ .../booterclient/ForkConfigurationTest.java | 2 +- ...ModularClasspathForkConfigurationTest.java | 47 ++++++++++++++++++- .../maven/plugin/surefire/SurefirePlugin.java | 21 +++++++++ 9 files changed, 150 insertions(+), 18 deletions(-) diff --git a/maven-failsafe-plugin/src/main/java/org/apache/maven/plugin/failsafe/IntegrationTestMojo.java b/maven-failsafe-plugin/src/main/java/org/apache/maven/plugin/failsafe/IntegrationTestMojo.java index ee12c6b0a7..ebcd1a22d2 100644 --- a/maven-failsafe-plugin/src/main/java/org/apache/maven/plugin/failsafe/IntegrationTestMojo.java +++ b/maven-failsafe-plugin/src/main/java/org/apache/maven/plugin/failsafe/IntegrationTestMojo.java @@ -401,6 +401,15 @@ public class IntegrationTestMojo @Parameter( property = "failsafe.useModulePath", defaultValue = "true" ) private boolean useModulePath; + /** + * When {@code true}, Surefire {@code --add-opens} the test packages at runtime, this enables deep reflection on + * test classes and may be required by test runners. By default, Failsafe {@code --add-exports} these packages. + * + * @since 3.0.0-M6 + */ + @Parameter( property = "failsafe.useJpmsAddOpens", defaultValue = "false" ) + private boolean useJpmsAddOpens; + /** * This parameter configures the forked node. Currently, you can select the communication protocol, i.e. process * pipes or TCP/IP sockets. @@ -959,6 +968,18 @@ protected void setUseModulePath( boolean useModulePath ) this.useModulePath = useModulePath; } + @Override + protected boolean useJpmsAddOpens() + { + return useJpmsAddOpens; + } + + @Override + protected void setUseJpmsAddOpens( boolean useJpmsAddOpens ) + { + this.useJpmsAddOpens = useJpmsAddOpens; + } + @Override protected final List suiteXmlFiles() { diff --git a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/AbstractSurefireMojo.java b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/AbstractSurefireMojo.java index 24bf9afd59..4f05e19577 100644 --- a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/AbstractSurefireMojo.java +++ b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/AbstractSurefireMojo.java @@ -884,6 +884,10 @@ protected abstract void handleSummary( RunResult summary, Exception firstForkExc protected abstract void setUseModulePath( boolean useModulePath ); + protected abstract boolean useJpmsAddOpens(); + + protected abstract void setUseJpmsAddOpens( boolean useJpmsAddOpens ); + protected abstract String getEnableProcessChecker(); protected abstract ForkNodeFactory getForkNode(); @@ -2472,19 +2476,21 @@ private ForkConfiguration createForkConfiguration( @Nonnull Platform platform, if ( canExecuteProviderWithModularPath( platform, resolvedJavaModularityResult ) ) { return new ModularClasspathForkConfiguration( bootClasspath, - tmpDir, - getEffectiveDebugForkedProcess(), - getWorkingDirectory() != null ? getWorkingDirectory() : getBasedir(), - getProject().getModel().getProperties(), - getArgLine(), - getEnvironmentVariables(), - getExcludedEnvironmentVariables(), - getConsoleLogger().isDebugEnabled(), - getEffectiveForkCount(), - reuseForks, - platform, - getConsoleLogger(), - forkNode ); + tmpDir, + getEffectiveDebugForkedProcess(), + getWorkingDirectory() != null + ? getWorkingDirectory() : getBasedir(), + getProject().getModel().getProperties(), + getArgLine(), + getEnvironmentVariables(), + getExcludedEnvironmentVariables(), + getConsoleLogger().isDebugEnabled(), + getEffectiveForkCount(), + reuseForks, + platform, + getConsoleLogger(), + forkNode, + useJpmsAddOpens() ); } else if ( getClassLoaderConfiguration().isManifestOnlyJarRequestedAndUsable() ) { diff --git a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/booterclient/ModularClasspathForkConfiguration.java b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/booterclient/ModularClasspathForkConfiguration.java index fc89016b5b..1a1d7af878 100644 --- a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/booterclient/ModularClasspathForkConfiguration.java +++ b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/booterclient/ModularClasspathForkConfiguration.java @@ -55,6 +55,8 @@ public class ModularClasspathForkConfiguration extends DefaultForkConfiguration { + private final boolean useJpmsAddOpens; + @SuppressWarnings( "checkstyle:parameternumber" ) public ModularClasspathForkConfiguration( @Nonnull Classpath bootClasspath, @Nonnull File tempDirectory, @@ -69,11 +71,13 @@ public ModularClasspathForkConfiguration( @Nonnull Classpath bootClasspath, boolean reuseForks, @Nonnull Platform pluginPlatform, @Nonnull ConsoleLogger log, - @Nonnull ForkNodeFactory forkNodeFactory ) + @Nonnull ForkNodeFactory forkNodeFactory, + boolean useJpmsAddOpens ) { super( bootClasspath, tempDirectory, debugLine, workingDirectory, modelProperties, argLine, environmentVariables, excludedEnvironmentVariables, debug, forkCount, reuseForks, pluginPlatform, log, forkNodeFactory ); + this.useJpmsAddOpens = useJpmsAddOpens; } @Override @@ -183,7 +187,7 @@ File createArgsFile( @Nonnull String moduleName, @Nonnull List modulePat for ( String pkg : packages ) { - args.append( "--add-opens" ) + args.append( useJpmsAddOpens ? "--add-opens" : "--add-exports" ) .append( NL ) .append( moduleName ) .append( '/' ) diff --git a/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/AbstractSurefireMojoJava7PlusTest.java b/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/AbstractSurefireMojoJava7PlusTest.java index 6c9a7e1c29..7f7d5ef80c 100644 --- a/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/AbstractSurefireMojoJava7PlusTest.java +++ b/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/AbstractSurefireMojoJava7PlusTest.java @@ -910,6 +910,18 @@ protected void setUseModulePath( boolean useModulePath ) } + @Override + protected boolean useJpmsAddOpens() + { + return false; + } + + @Override + protected void setUseJpmsAddOpens( boolean useJpmsAddOpens ) + { + + } + @Override protected String getEnableProcessChecker() { diff --git a/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/AbstractSurefireMojoTest.java b/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/AbstractSurefireMojoTest.java index b1afb7f305..dbde668d8a 100644 --- a/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/AbstractSurefireMojoTest.java +++ b/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/AbstractSurefireMojoTest.java @@ -1987,6 +1987,7 @@ public static class Mojo private File mainBuildPath; private File testClassesDirectory; private boolean useModulePath; + private boolean useJpmsAddOpens; private int failOnFlakeCount; private String[] includeJUnit5Engines; private String[] excludeJUnit5Engines; @@ -2393,6 +2394,18 @@ protected void setUseModulePath( boolean useModulePath ) this.useModulePath = useModulePath; } + @Override + protected boolean useJpmsAddOpens() + { + return useJpmsAddOpens; + } + + @Override + protected void setUseJpmsAddOpens( boolean useJpmsAddOpens ) + { + this.useJpmsAddOpens = useJpmsAddOpens; + } + @Override protected String getEnableProcessChecker() { diff --git a/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/MojoMocklessTest.java b/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/MojoMocklessTest.java index 5db863925a..3a689a9b53 100644 --- a/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/MojoMocklessTest.java +++ b/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/MojoMocklessTest.java @@ -763,6 +763,18 @@ protected void setUseModulePath( boolean useModulePath ) } + @Override + protected boolean useJpmsAddOpens() + { + return false; + } + + @Override + protected void setUseJpmsAddOpens( boolean useJpmsAddOpens ) + { + + } + @Override protected ForkNodeFactory getForkNode() { diff --git a/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/booterclient/ForkConfigurationTest.java b/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/booterclient/ForkConfigurationTest.java index 0784cf93c3..1651fbd13d 100644 --- a/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/booterclient/ForkConfigurationTest.java +++ b/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/booterclient/ForkConfigurationTest.java @@ -145,7 +145,7 @@ public void testCliArgs() throws Exception ModularClasspathForkConfiguration config = new ModularClasspathForkConfiguration( emptyClasspath(), basedir, "", basedir, new Properties(), "arg1", Collections.emptyMap(), new String[0], false, 1, - true, platform, new NullConsoleLogger(), mock( ForkNodeFactory.class ) ); + true, platform, new NullConsoleLogger(), mock( ForkNodeFactory.class ), false ); assertThat( config.isDebug() ).isFalse(); diff --git a/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/booterclient/ModularClasspathForkConfigurationTest.java b/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/booterclient/ModularClasspathForkConfigurationTest.java index 14ea5623cd..1775742e2b 100644 --- a/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/booterclient/ModularClasspathForkConfigurationTest.java +++ b/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/booterclient/ModularClasspathForkConfigurationTest.java @@ -68,7 +68,7 @@ public void shouldCreateModularArgsFile() throws Exception ModularClasspathForkConfiguration config = new ModularClasspathForkConfiguration( booter, tmp, "", pwd, new Properties(), "", Collections.emptyMap(), new String[0], true, 1, true, - new Platform(), new NullConsoleLogger(), mock( ForkNodeFactory.class ) ); + new Platform(), new NullConsoleLogger(), mock( ForkNodeFactory.class ), false ); File patchFile = new File( "target" + separatorChar + "test-classes" ); File descriptor = new File( tmp, "module-info.class" ); @@ -116,7 +116,7 @@ public void shouldCreateModularArgsFile() throws Exception .isEqualTo( "abc=\"" + replace( patchFile.getPath(), "\\", "\\\\" ) + "\"" ); assertThat( argsFileLines.get( 6 ) ) - .isEqualTo( "--add-opens" ); + .isEqualTo( "--add-exports" ); assertThat( argsFileLines.get( 7 ) ) .isEqualTo( "abc/org.apache.abc=ALL-UNNAMED" ); @@ -162,4 +162,47 @@ public void shouldCreateModularArgsFile() throws Exception assertThat( line ).isEqualTo( argsFileLines.get( i ) ); } } + + @Test + @SuppressWarnings( "ResultOfMethodCallIgnored" ) + public void shouldCreateModularArgsFileWithAddOpens() throws Exception + { + Classpath booter = new Classpath( asList( "booter.jar", "non-modular.jar" ) ); + File target = new File( "target" ).getCanonicalFile(); + File tmp = new File( target, "surefire" ); + tmp.mkdirs(); + File pwd = new File( "." ).getCanonicalFile(); + + ModularClasspathForkConfiguration config = new ModularClasspathForkConfiguration( booter, tmp, "", pwd, + new Properties(), "", + Collections.emptyMap(), + new String[0], true, 1, + true, new Platform(), + new NullConsoleLogger(), + mock( ForkNodeFactory.class ), + true ); + + File patchFile = new File( "target" + separatorChar + "test-classes" ); + File descriptor = new File( tmp, "module-info.class" ); + descriptor.createNewFile(); + List modulePath = + asList( "modular.jar", "target" + separatorChar + "classes" ); + List classPath = asList( "booter.jar", "non-modular.jar", patchFile.getPath() ); + Collection packages = singleton( "org.apache.abc" ); + String startClassName = ForkedBooter.class.getName(); + + File jigsawArgsFile = config.createArgsFile( "abc", modulePath, classPath, packages, patchFile, + startClassName, true, Collections.emptyList() ); + + assertThat( jigsawArgsFile ) + .isNotNull(); + + List argsFileLines = readAllLines( jigsawArgsFile.toPath(), UTF_8 ); + + assertThat( argsFileLines ) + .hasSize( 13 ); + + assertThat( argsFileLines.get( 6 ) ) + .isEqualTo( "--add-opens" ); + } } diff --git a/maven-surefire-plugin/src/main/java/org/apache/maven/plugin/surefire/SurefirePlugin.java b/maven-surefire-plugin/src/main/java/org/apache/maven/plugin/surefire/SurefirePlugin.java index 0e3d850dd5..46d9648d8d 100644 --- a/maven-surefire-plugin/src/main/java/org/apache/maven/plugin/surefire/SurefirePlugin.java +++ b/maven-surefire-plugin/src/main/java/org/apache/maven/plugin/surefire/SurefirePlugin.java @@ -391,6 +391,15 @@ public class SurefirePlugin @Parameter( property = "surefire.useModulePath", defaultValue = "true" ) private boolean useModulePath; + /** + * When {@code true}, Surefire {@code --add-opens} the test packages at runtime, this enables deep reflection on + * test classes and may be required by test runners. By default, Surefire {@code --add-exports} these packages. + * + * @since 3.0.0-M6 + */ + @Parameter( property = "surefire.useJpmsAddOpens", defaultValue = "false" ) + private boolean useJpmsAddOpens; + /** * This parameter configures the forked node. Currently, you can select the communication protocol, i.e. process * pipes or TCP/IP sockets. @@ -884,6 +893,18 @@ protected void setUseModulePath( boolean useModulePath ) this.useModulePath = useModulePath; } + @Override + protected boolean useJpmsAddOpens() + { + return useJpmsAddOpens; + } + + @Override + protected void setUseJpmsAddOpens( boolean useJpmsAddOpens ) + { + this.useJpmsAddOpens = useJpmsAddOpens; + } + @Override protected final List suiteXmlFiles() { From 1dc09d28199b51b3f08aadd45db98f382b9b8922 Mon Sep 17 00:00:00 2001 From: Nils Renaud Date: Wed, 9 Feb 2022 14:09:18 +0100 Subject: [PATCH 3/3] SUREFIRE-1909 Add integration tests Signed-off-by: Nils Renaud --- .../its/ModulePathWithAddOpensIT.java | 69 +++++++++++++++++++ .../modulepath-use-add-opens/pom.xml | 49 +++++++++++++ .../src/main/java/com/app/Main.java | 34 +++++++++ .../src/main/java/module-info.java | 21 ++++++ .../src/test/java/com/app/AppTest.java | 37 ++++++++++ 5 files changed, 210 insertions(+) create mode 100644 surefire-its/src/test/java/org/apache/maven/surefire/its/ModulePathWithAddOpensIT.java create mode 100644 surefire-its/src/test/resources/modulepath-use-add-opens/pom.xml create mode 100644 surefire-its/src/test/resources/modulepath-use-add-opens/src/main/java/com/app/Main.java create mode 100644 surefire-its/src/test/resources/modulepath-use-add-opens/src/main/java/module-info.java create mode 100644 surefire-its/src/test/resources/modulepath-use-add-opens/src/test/java/com/app/AppTest.java diff --git a/surefire-its/src/test/java/org/apache/maven/surefire/its/ModulePathWithAddOpensIT.java b/surefire-its/src/test/java/org/apache/maven/surefire/its/ModulePathWithAddOpensIT.java new file mode 100644 index 0000000000..826b9009f4 --- /dev/null +++ b/surefire-its/src/test/java/org/apache/maven/surefire/its/ModulePathWithAddOpensIT.java @@ -0,0 +1,69 @@ +package org.apache.maven.surefire.its; + +/* + * 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 java.io.IOException; + +import org.apache.maven.surefire.its.fixture.AbstractJava9PlusIT; +import org.junit.Test; + +/** + * + */ +public class ModulePathWithAddOpensIT + extends AbstractJava9PlusIT +{ + private String suffix; + + @Test + public void testModulePath() + throws IOException + { + assumeJava9() + .debugLogging() + .executeTest() + .verifyErrorFreeLog() + .assertTestSuiteResults( 2 ); + } + + @Test + public void testModulePathWithSpaces() + throws IOException + { + suffix = " with spaces"; + assumeJava9() + .debugLogging() + .executeTest() + .verifyErrorFreeLog() + .assertTestSuiteResults( 2 ); + } + + @Override + protected String getProjectDirectoryName() + { + return "modulepath-use-add-opens"; + } + + @Override + protected String getSuffix() + { + return suffix; + } +} diff --git a/surefire-its/src/test/resources/modulepath-use-add-opens/pom.xml b/surefire-its/src/test/resources/modulepath-use-add-opens/pom.xml new file mode 100644 index 0000000000..88914008f6 --- /dev/null +++ b/surefire-its/src/test/resources/modulepath-use-add-opens/pom.xml @@ -0,0 +1,49 @@ + + + 4.0.0 + + foo + app + 1.0.0-SNAPSHOT + + app + + + UTF-8 + ${java.specification.version} + + + + + + org.apache.maven.plugins + maven-compiler-plugin + 3.8.1 + + + org.apache.maven.plugins + maven-surefire-plugin + ${surefire.version} + + true + + + + + + + + joda-time + joda-time + 2.9.9 + + + org.junit.jupiter + junit-jupiter-engine + 5.6.2 + test + + + + diff --git a/surefire-its/src/test/resources/modulepath-use-add-opens/src/main/java/com/app/Main.java b/surefire-its/src/test/resources/modulepath-use-add-opens/src/main/java/com/app/Main.java new file mode 100644 index 0000000000..6a44492657 --- /dev/null +++ b/surefire-its/src/test/resources/modulepath-use-add-opens/src/main/java/com/app/Main.java @@ -0,0 +1,34 @@ +package com.app; + +/* + * 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.joda.time.DateTime; + +public class Main +{ + public static void main( String... args ) + { + System.out.println( "module path => " + System.getProperty( "jdk.module.path" ) ); + System.out.println( " class path => " + System.getProperty( "java.class.path" ) ); + + DateTime dt = new DateTime(); + System.out.println( dt ); + } +} diff --git a/surefire-its/src/test/resources/modulepath-use-add-opens/src/main/java/module-info.java b/surefire-its/src/test/resources/modulepath-use-add-opens/src/main/java/module-info.java new file mode 100644 index 0000000000..5f3eed410c --- /dev/null +++ b/surefire-its/src/test/resources/modulepath-use-add-opens/src/main/java/module-info.java @@ -0,0 +1,21 @@ +/* + * 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. + */ +module com.app { + requires joda.time; +} diff --git a/surefire-its/src/test/resources/modulepath-use-add-opens/src/test/java/com/app/AppTest.java b/surefire-its/src/test/resources/modulepath-use-add-opens/src/test/java/com/app/AppTest.java new file mode 100644 index 0000000000..8f2d3f537f --- /dev/null +++ b/surefire-its/src/test/resources/modulepath-use-add-opens/src/test/java/com/app/AppTest.java @@ -0,0 +1,37 @@ +package com.app; + +/* + * 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.junit.jupiter.api.Test; + +public class AppTest +{ + @Test + void testNoop() + throws Exception + { + } + + @Test + void testMain() + { + Main.main(); + } +}