From 74dadfd0af12994d49549f35de8b71a92a4f1ba1 Mon Sep 17 00:00:00 2001 From: Slawomir Jaranowski Date: Sun, 5 May 2024 11:38:04 +0200 Subject: [PATCH] [MSHARED-1152] Remove public modifier for JUnit5 tests --- pom.xml | 2 +- .../shared/invoker/DefaultInvokerTest.java | 22 ++-- .../invoker/MavenCommandLineBuilderTest.java | 122 +++++++++--------- .../shared/invoker/SystemOutHandlerTest.java | 8 +- .../shared/invoker/SystemOutLoggerTest.java | 64 ++++----- 5 files changed, 109 insertions(+), 109 deletions(-) diff --git a/pom.xml b/pom.xml index 22720d7..74b78e9 100644 --- a/pom.xml +++ b/pom.xml @@ -81,7 +81,7 @@ under the License. org.junit.jupiter - junit-jupiter + junit-jupiter-api test diff --git a/src/test/java/org/apache/maven/shared/invoker/DefaultInvokerTest.java b/src/test/java/org/apache/maven/shared/invoker/DefaultInvokerTest.java index 978e0ed..6a94b64 100644 --- a/src/test/java/org/apache/maven/shared/invoker/DefaultInvokerTest.java +++ b/src/test/java/org/apache/maven/shared/invoker/DefaultInvokerTest.java @@ -33,7 +33,7 @@ import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertTrue; -public class DefaultInvokerTest { +class DefaultInvokerTest { private Invoker invoker = newInvoker(); private InvocationRequest request = new DefaultInvocationRequest(); @@ -46,7 +46,7 @@ public void setUp() { @Test @SuppressWarnings("deprecation") - public void testBuildShouldSucceed() throws MavenInvocationException, URISyntaxException { + void testBuildShouldSucceed() throws MavenInvocationException, URISyntaxException { File basedir = getBasedirForBuild(); request.setBaseDirectory(basedir); request.setGoals(Arrays.asList("clean", "package")); @@ -57,7 +57,7 @@ public void testBuildShouldSucceed() throws MavenInvocationException, URISyntaxE } @Test - public void testBuildShouldFail() throws MavenInvocationException, URISyntaxException { + void testBuildShouldFail() throws MavenInvocationException, URISyntaxException { File basedir = getBasedirForBuild(); request.setBaseDirectory(basedir); request.addArgs(Arrays.asList("clean", "package")); @@ -68,7 +68,7 @@ public void testBuildShouldFail() throws MavenInvocationException, URISyntaxExce } @Test - public void testBuildShouldTimeout() throws MavenInvocationException, URISyntaxException { + void testBuildShouldTimeout() throws MavenInvocationException, URISyntaxException { File basedir = getBasedirForBuild(); request.setBaseDirectory(basedir); request.addArgs(Arrays.asList("clean", "package")); @@ -89,7 +89,7 @@ public void testBuildShouldTimeout() throws MavenInvocationException, URISyntaxE } @Test - public void testSpacePom() throws Exception { + void testSpacePom() throws Exception { File basedir = getBasedirForBuild(); request.setBaseDirectory(basedir); request.setPomFileName("pom with spaces.xml"); @@ -101,7 +101,7 @@ public void testSpacePom() throws Exception { } @Test - public void testSpaceAndSpecialCharPom() throws Exception { + void testSpaceAndSpecialCharPom() throws Exception { File basedir = getBasedirForBuild(); request.setBaseDirectory(basedir); request.setPomFileName("pom with spaces & special char.xml"); @@ -113,7 +113,7 @@ public void testSpaceAndSpecialCharPom() throws Exception { } @Test - public void testSpaceSettings() throws Exception { + void testSpaceSettings() throws Exception { File basedir = getBasedirForBuild(); request.setBaseDirectory(basedir); request.setUserSettingsFile(new File(basedir, "settings with spaces.xml")); @@ -125,7 +125,7 @@ public void testSpaceSettings() throws Exception { } @Test - public void testSpaceLocalRepo() throws Exception { + void testSpaceLocalRepo() throws Exception { File basedir = getBasedirForBuild(); request.setBaseDirectory(basedir); request.setLocalRepositoryDirectory(new File(basedir, "repo with spaces")); @@ -137,7 +137,7 @@ public void testSpaceLocalRepo() throws Exception { } @Test - public void testSpaceProperties() throws Exception { + void testSpaceProperties() throws Exception { File basedir = getBasedirForBuild(); request.setBaseDirectory(basedir); Properties props = getProperties(); @@ -152,7 +152,7 @@ public void testSpaceProperties() throws Exception { } @Test - public void testPomOutsideProject() throws Exception { + void testPomOutsideProject() throws Exception { File basedir = getBasedirForBuild(); request.setBaseDirectory(basedir); File pom = new File(basedir, "temp/pom.xml"); @@ -165,7 +165,7 @@ public void testPomOutsideProject() throws Exception { } @Test - public void testMavenWrapperInProject() throws Exception { + void testMavenWrapperInProject() throws Exception { File basedir = getBasedirForBuild(); request.setBaseDirectory(basedir); request.addArg("test-wrapper-goal"); diff --git a/src/test/java/org/apache/maven/shared/invoker/MavenCommandLineBuilderTest.java b/src/test/java/org/apache/maven/shared/invoker/MavenCommandLineBuilderTest.java index ed26f8e..bbd2ce6 100644 --- a/src/test/java/org/apache/maven/shared/invoker/MavenCommandLineBuilderTest.java +++ b/src/test/java/org/apache/maven/shared/invoker/MavenCommandLineBuilderTest.java @@ -48,9 +48,9 @@ import static org.junit.jupiter.api.Assertions.assertTrue; import static org.junit.jupiter.api.Assumptions.assumeTrue; -public class MavenCommandLineBuilderTest { +class MavenCommandLineBuilderTest { @TempDir - public Path temporaryFolder; + private Path temporaryFolder; private Properties sysProps; private File lrd; @@ -58,7 +58,7 @@ public class MavenCommandLineBuilderTest { private Commandline cli = new Commandline(); @BeforeEach - public void setUp() throws IOException { + void setUp() throws IOException { sysProps = System.getProperties(); Properties p = new Properties(sysProps); @@ -68,12 +68,12 @@ public void setUp() throws IOException { } @AfterEach - public void tearDown() { + void tearDown() { System.setProperties(sysProps); } @Test - public void testShouldFailToSetLocalRepoLocationGloballyWhenItIsAFile() { + void testShouldFailToSetLocalRepoLocationGloballyWhenItIsAFile() { mclb.setLocalRepositoryDirectory(lrd); @@ -82,14 +82,14 @@ public void testShouldFailToSetLocalRepoLocationGloballyWhenItIsAFile() { } @Test - public void testShouldFailToSetLocalRepoLocationFromRequestWhenItIsAFile() { + void testShouldFailToSetLocalRepoLocationFromRequestWhenItIsAFile() { InvocationRequest request = newRequest().setLocalRepositoryDirectory(lrd); assertThrows(IllegalArgumentException.class, () -> mclb.setLocalRepository(request, cli)); } @Test - public void testShouldSetLocalRepoLocationGlobally() throws IOException { + void testShouldSetLocalRepoLocationGlobally() throws IOException { File lrd = Files.createDirectory(temporaryFolder.resolve("workdir")) .toFile() .getCanonicalFile(); @@ -100,7 +100,7 @@ public void testShouldSetLocalRepoLocationGlobally() throws IOException { } @Test - public void testShouldSetLocalRepoLocationFromRequest() throws Exception { + void testShouldSetLocalRepoLocationFromRequest() throws Exception { File lrd = Files.createDirectory(temporaryFolder.resolve("workdir")) .toFile() .getCanonicalFile(); @@ -110,7 +110,7 @@ public void testShouldSetLocalRepoLocationFromRequest() throws Exception { } @Test - public void testRequestProvidedLocalRepoLocationShouldOverrideGlobal() throws Exception { + void testRequestProvidedLocalRepoLocationShouldOverrideGlobal() throws Exception { File lrd = Files.createDirectory(temporaryFolder.resolve("workdir")) .toFile() .getCanonicalFile(); @@ -125,7 +125,7 @@ public void testRequestProvidedLocalRepoLocationShouldOverrideGlobal() throws Ex } @Test - public void testShouldSetWorkingDirectoryGlobally() throws Exception { + void testShouldSetWorkingDirectoryGlobally() throws Exception { File wd = Files.createDirectory(temporaryFolder.resolve("workdir")).toFile(); mclb.setBaseDirectory(wd); @@ -135,7 +135,7 @@ public void testShouldSetWorkingDirectoryGlobally() throws Exception { } @Test - public void testShouldSetWorkingDirectoryFromRequest() throws Exception { + void testShouldSetWorkingDirectoryFromRequest() throws Exception { File wd = Files.createDirectory(temporaryFolder.resolve("workdir")).toFile(); InvocationRequest req = newRequest(); @@ -147,7 +147,7 @@ public void testShouldSetWorkingDirectoryFromRequest() throws Exception { } @Test - public void testRequestProvidedWorkingDirectoryShouldOverrideGlobal() throws Exception { + void testRequestProvidedWorkingDirectoryShouldOverrideGlobal() throws Exception { File wd = Files.createDirectory(temporaryFolder.resolve("workdir")).toFile(); File gwd = Files.createDirectory(temporaryFolder.resolve("global-workdir")).toFile(); @@ -163,7 +163,7 @@ public void testRequestProvidedWorkingDirectoryShouldOverrideGlobal() throws Exc } @Test - public void testShouldUseSystemOutLoggerWhenNoneSpecified() throws Exception { + void testShouldUseSystemOutLoggerWhenNoneSpecified() throws Exception { setupTempMavenHomeIfMissing(false); mclb.checkRequiredState(); @@ -200,14 +200,14 @@ private File setupTempMavenHomeIfMissing(boolean forceDummy) throws Exception { } @Test - public void testShouldFailIfLoggerSetToNull() { + void testShouldFailIfLoggerSetToNull() { mclb.setLogger(null); assertThrows(IllegalStateException.class, () -> mclb.checkRequiredState()); } @Test - public void testShouldFindDummyMavenExecutable() throws Exception { + void testShouldFindDummyMavenExecutable() throws Exception { File dummyMavenHomeBin = Files.createDirectories(temporaryFolder .resolve("invoker-tests") .resolve("dummy-maven-home") @@ -229,7 +229,7 @@ public void testShouldFindDummyMavenExecutable() throws Exception { @Test @EnabledOnOs(OS.WINDOWS) - public void testShouldFindDummyPS1MavenExecutable() throws Exception { + void testShouldFindDummyPS1MavenExecutable() throws Exception { File dummyMavenHomeBin = Files.createDirectories(temporaryFolder .resolve("invoker-tests") .resolve("dummy-maven-home") @@ -244,7 +244,7 @@ public void testShouldFindDummyPS1MavenExecutable() throws Exception { } @Test - public void testShouldFindDummyMavenExecutableWithMavenHomeFromRequest() throws Exception { + void testShouldFindDummyMavenExecutableWithMavenHomeFromRequest() throws Exception { File dummyMavenHomeBin = Files.createDirectories(temporaryFolder .resolve("invoker-tests") .resolve("dummy-maven-home") @@ -266,7 +266,7 @@ public void testShouldFindDummyMavenExecutableWithMavenHomeFromRequest() throws } @Test - public void testShouldSetBatchModeFlagFromRequest() { + void testShouldSetBatchModeFlagFromRequest() { mclb.setFlags(newRequest().setBatchMode(true), cli); @@ -274,7 +274,7 @@ public void testShouldSetBatchModeFlagFromRequest() { } @Test - public void testShouldSetOfflineFlagFromRequest() { + void testShouldSetOfflineFlagFromRequest() { mclb.setFlags(newRequest().setOffline(true), cli); @@ -282,7 +282,7 @@ public void testShouldSetOfflineFlagFromRequest() { } @Test - public void testShouldSetUpdateSnapshotsFlagFromRequest() { + void testShouldSetUpdateSnapshotsFlagFromRequest() { mclb.setFlags(newRequest().setUpdateSnapshots(true), cli); @@ -317,7 +317,7 @@ void testShouldSetUpdateSnapshotsPolicyNeverFromRequest() { } @Test - public void testShouldSetDebugFlagFromRequest() { + void testShouldSetDebugFlagFromRequest() { mclb.setFlags(newRequest().setDebug(true), cli); @@ -325,7 +325,7 @@ public void testShouldSetDebugFlagFromRequest() { } @Test - public void testShouldSetErrorFlagFromRequest() { + void testShouldSetErrorFlagFromRequest() { mclb.setFlags(newRequest().setShowErrors(true), cli); @@ -333,7 +333,7 @@ public void testShouldSetErrorFlagFromRequest() { } @Test - public void testShouldSetQuietFlagFromRequest() { + void testShouldSetQuietFlagFromRequest() { mclb.setFlags(newRequest().setQuiet(true), cli); @@ -341,21 +341,21 @@ public void testShouldSetQuietFlagFromRequest() { } @Test - public void testShouldSetNonRecursiveFlagsFromRequest() { + void testShouldSetNonRecursiveFlagsFromRequest() { mclb.setFlags(newRequest().setRecursive(false), cli); assertArgumentsPresent(cli, Collections.singleton("-N")); } @Test - public void testShouldSetShowVersionFlagsFromRequest() { + void testShouldSetShowVersionFlagsFromRequest() { mclb.setFlags(newRequest().setShowVersion(true), cli); assertArgumentsPresent(cli, Collections.singleton("-V")); } @Test - public void testDebugOptionShouldMaskShowErrorsOption() { + void testDebugOptionShouldMaskShowErrorsOption() { mclb.setFlags(newRequest().setDebug(true).setShowErrors(true), cli); @@ -364,14 +364,14 @@ public void testDebugOptionShouldMaskShowErrorsOption() { } @Test - public void testShouldSetBuilderIdOptionsFromRequest() { + void testShouldSetBuilderIdOptionsFromRequest() { mclb.setFlags(newRequest().setBuilder("builder-id-123"), cli); assertArgumentsPresentInOrder(cli, "-b", "builder-id-123"); } @Test - public void testAlsoMake() { + void testAlsoMake() { mclb.setReactorBehavior(newRequest().setAlsoMake(true), cli); @@ -380,7 +380,7 @@ public void testAlsoMake() { } @Test - public void testProjectsAndAlsoMake() { + void testProjectsAndAlsoMake() { mclb.setReactorBehavior( newRequest().setProjects(Collections.singletonList("proj1")).setAlsoMake(true), cli); @@ -389,7 +389,7 @@ public void testProjectsAndAlsoMake() { } @Test - public void testAlsoMakeDependents() { + void testAlsoMakeDependents() { mclb.setReactorBehavior(newRequest().setAlsoMakeDependents(true), cli); @@ -398,7 +398,7 @@ public void testAlsoMakeDependents() { } @Test - public void testProjectsAndAlsoMakeDependents() { + void testProjectsAndAlsoMakeDependents() { mclb.setReactorBehavior( newRequest().setProjects(Collections.singletonList("proj1")).setAlsoMakeDependents(true), cli); @@ -407,7 +407,7 @@ public void testProjectsAndAlsoMakeDependents() { } @Test - public void testProjectsAndAlsoMakeAndAlsoMakeDependents() { + void testProjectsAndAlsoMakeAndAlsoMakeDependents() { mclb.setReactorBehavior( newRequest() @@ -420,7 +420,7 @@ public void testProjectsAndAlsoMakeAndAlsoMakeDependents() { } @Test - public void testShouldSetResumeFrom() { + void testShouldSetResumeFrom() { mclb.setReactorBehavior(newRequest().setResumeFrom(":module3"), cli); @@ -428,7 +428,7 @@ public void testShouldSetResumeFrom() { } @Test - public void testShouldSetStrictChecksumPolityFlagFromRequest() { + void testShouldSetStrictChecksumPolityFlagFromRequest() { mclb.setFlags(newRequest().setGlobalChecksumPolicy(InvocationRequest.CheckSumPolicy.Fail), cli); @@ -436,7 +436,7 @@ public void testShouldSetStrictChecksumPolityFlagFromRequest() { } @Test - public void testShouldSetLaxChecksumPolicyFlagFromRequest() { + void testShouldSetLaxChecksumPolicyFlagFromRequest() { mclb.setFlags(newRequest().setGlobalChecksumPolicy(InvocationRequest.CheckSumPolicy.Warn), cli); @@ -444,7 +444,7 @@ public void testShouldSetLaxChecksumPolicyFlagFromRequest() { } @Test - public void testShouldSetFailAtEndFlagFromRequest() { + void testShouldSetFailAtEndFlagFromRequest() { mclb.setReactorBehavior( newRequest().setReactorFailureBehavior(InvocationRequest.ReactorFailureBehavior.FailAtEnd), cli); @@ -453,7 +453,7 @@ public void testShouldSetFailAtEndFlagFromRequest() { } @Test - public void testShouldSetFailNeverFlagFromRequest() { + void testShouldSetFailNeverFlagFromRequest() { mclb.setReactorBehavior( newRequest().setReactorFailureBehavior(InvocationRequest.ReactorFailureBehavior.FailNever), cli); @@ -462,7 +462,7 @@ public void testShouldSetFailNeverFlagFromRequest() { } @Test - public void testShouldAddArg() throws CommandLineConfigurationException { + void testShouldAddArg() throws CommandLineConfigurationException { InvocationRequest request = newRequest().addArg("arg1").addArg("arg2").setQuiet(true).setBuilder("bId"); @@ -474,7 +474,7 @@ public void testShouldAddArg() throws CommandLineConfigurationException { } @Test - public void testShouldUseDefaultOfFailFastWhenSpecifiedInRequest() { + void testShouldUseDefaultOfFailFastWhenSpecifiedInRequest() { mclb.setReactorBehavior( newRequest().setReactorFailureBehavior(InvocationRequest.ReactorFailureBehavior.FailFast), cli); @@ -487,13 +487,13 @@ public void testShouldUseDefaultOfFailFastWhenSpecifiedInRequest() { } @Test - public void testShouldSetNoTransferProgressFlagFromRequest() { + void testShouldSetNoTransferProgressFlagFromRequest() { mclb.setFlags(newRequest().setNoTransferProgress(true), cli); assertArgumentsPresent(cli, Collections.singleton("-ntp")); } @Test - public void testShouldSpecifyFileOptionUsingNonStandardPomFileLocation() throws Exception { + void testShouldSpecifyFileOptionUsingNonStandardPomFileLocation() throws Exception { File projectDir = Files.createDirectories( temporaryFolder.resolve("invoker-tests").resolve("file-option-nonstd-pom-file-location")) .toFile(); @@ -514,7 +514,7 @@ public void testShouldSpecifyFileOptionUsingNonStandardPomFileLocation() throws } @Test - public void testShouldNotSpecifyFileOptionUsingStandardPomFileLocation() throws Exception { + void testShouldNotSpecifyFileOptionUsingStandardPomFileLocation() throws Exception { File projectDir = Files.createDirectories( temporaryFolder.resolve("invoker-tests").resolve("std-pom-file-location")) .toFile(); @@ -535,7 +535,7 @@ public void testShouldNotSpecifyFileOptionUsingStandardPomFileLocation() throws } @Test - public void testShouldSetPomForOutsideWorkspace() throws Exception { + void testShouldSetPomForOutsideWorkspace() throws Exception { File projectDir = Files.createDirectories( temporaryFolder.resolve("invoker-tests").resolve("std-pom-file-location")) .toFile(); @@ -556,7 +556,7 @@ public void testShouldSetPomForOutsideWorkspace() throws Exception { } @Test - public void testShouldNotSpecifyFileOptionUsingStandardPomInBasedir() throws Exception { + void testShouldNotSpecifyFileOptionUsingStandardPomInBasedir() throws Exception { File projectDir = Files.createDirectories( temporaryFolder.resolve("invoker-tests").resolve("std-basedir-is-pom-file")) .toFile(); @@ -577,7 +577,7 @@ public void testShouldNotSpecifyFileOptionUsingStandardPomInBasedir() throws Exc } @Test - public void testShouldUseDefaultPomFileWhenBasedirSpecifiedWithoutPomFileName() throws Exception { + void testShouldUseDefaultPomFileWhenBasedirSpecifiedWithoutPomFileName() throws Exception { File projectDir = Files.createDirectories( temporaryFolder.resolve("invoker-tests").resolve("std-basedir-no-pom-filename")) .toFile(); @@ -596,7 +596,7 @@ public void testShouldUseDefaultPomFileWhenBasedirSpecifiedWithoutPomFileName() } @Test - public void testShouldSpecifyPomFileWhenBasedirSpecifiedWithPomFileName() throws Exception { + void testShouldSpecifyPomFileWhenBasedirSpecifiedWithPomFileName() throws Exception { File projectDir = Files.createDirectories( temporaryFolder.resolve("invoker-tests").resolve("std-basedir-with-pom-filename")) .toFile(); @@ -615,7 +615,7 @@ public void testShouldSpecifyPomFileWhenBasedirSpecifiedWithPomFileName() throws } @Test - public void testShouldSpecifyCustomUserSettingsLocationFromRequest() throws Exception { + void testShouldSpecifyCustomUserSettingsLocationFromRequest() throws Exception { File projectDir = Files.createDirectories( temporaryFolder.resolve("invoker-tests").resolve("custom-settings")) .toFile(); @@ -632,7 +632,7 @@ public void testShouldSpecifyCustomUserSettingsLocationFromRequest() throws Exce } @Test - public void testShouldSpecifyCustomGlobalSettingsLocationFromRequest() throws Exception { + void testShouldSpecifyCustomGlobalSettingsLocationFromRequest() throws Exception { File projectDir = Files.createDirectories( temporaryFolder.resolve("invoker-tests").resolve("custom-settings")) .toFile() @@ -650,7 +650,7 @@ public void testShouldSpecifyCustomGlobalSettingsLocationFromRequest() throws Ex } @Test - public void testShouldSpecifyCustomToolchainsLocationFromRequest() throws Exception { + void testShouldSpecifyCustomToolchainsLocationFromRequest() throws Exception { File projectDir = Files.createDirectories( temporaryFolder.resolve("invoker-tests").resolve("custom-toolchains")) .toFile(); @@ -667,7 +667,7 @@ public void testShouldSpecifyCustomToolchainsLocationFromRequest() throws Except } @Test - public void testShouldSpecifyCustomPropertyFromRequest() { + void testShouldSpecifyCustomPropertyFromRequest() { Properties properties = new Properties(); properties.setProperty("key", "value"); @@ -678,7 +678,7 @@ public void testShouldSpecifyCustomPropertyFromRequest() { } @Test - public void testShouldSpecifyCustomPropertyWithSpacesInValueFromRequest() { + void testShouldSpecifyCustomPropertyWithSpacesInValueFromRequest() { Properties properties = new Properties(); properties.setProperty("key", "value with spaces"); @@ -689,7 +689,7 @@ public void testShouldSpecifyCustomPropertyWithSpacesInValueFromRequest() { } @Test - public void testShouldSpecifyCustomPropertyWithSpacesInKeyFromRequest() { + void testShouldSpecifyCustomPropertyWithSpacesInKeyFromRequest() { Properties properties = new Properties(); properties.setProperty("key with spaces", "value with spaces"); @@ -701,7 +701,7 @@ public void testShouldSpecifyCustomPropertyWithSpacesInKeyFromRequest() { @Test @SuppressWarnings("deprecation") - public void testShouldSpecifySingleGoalFromRequest() throws CommandLineConfigurationException { + void testShouldSpecifySingleGoalFromRequest() throws CommandLineConfigurationException { List goals = new ArrayList<>(); goals.add("test"); @@ -721,7 +721,7 @@ void testShouldSpecifySingleGoalFromRequestArg() throws CommandLineConfiguration @Test @SuppressWarnings("deprecation") - public void testShouldSpecifyTwoGoalsFromRequest() throws CommandLineConfigurationException { + void testShouldSpecifyTwoGoalsFromRequest() throws CommandLineConfigurationException { List goals = new ArrayList<>(); goals.add("test"); goals.add("clean"); @@ -745,14 +745,14 @@ void testShouldSpecifyTwoGoalsFromRequestArgs() throws CommandLineConfigurationE } @Test - public void testShouldSpecifyThreadsFromRequest() { + void testShouldSpecifyThreadsFromRequest() { mclb.setThreads(newRequest().setThreads("2.0C"), cli); assertArgumentsPresentInOrder(cli, "-T", "2.0C"); } @Test - public void testBuildTypicalMavenInvocationEndToEnd() throws Exception { + void testBuildTypicalMavenInvocationEndToEnd() throws Exception { File mavenDir = setupTempMavenHomeIfMissing(false); InvocationRequest request = newRequest(); @@ -805,7 +805,7 @@ public void testBuildTypicalMavenInvocationEndToEnd() throws Exception { } @Test - public void testShouldInsertActivatedProfiles() throws Exception { + void testShouldInsertActivatedProfiles() throws Exception { setupTempMavenHomeIfMissing(false); String profile1 = "profile-1"; @@ -825,7 +825,7 @@ public void testShouldInsertActivatedProfiles() throws Exception { } @Test - public void testMvnExecutableFromInvoker() throws Exception { + void testMvnExecutableFromInvoker() throws Exception { assumeTrue(Objects.nonNull(System.getProperty("maven.home")), "Test only works when maven.home is set"); File mavenExecutable = new File("mvnDebug"); @@ -839,7 +839,7 @@ public void testMvnExecutableFromInvoker() throws Exception { } @Test - public void testMvnExecutableFormRequest() throws Exception { + void testMvnExecutableFormRequest() throws Exception { assumeTrue(Objects.nonNull(System.getProperty("maven.home")), "Test only works when maven.home is set"); File mavenExecutable = new File("mvnDebug"); @@ -852,7 +852,7 @@ public void testMvnExecutableFormRequest() throws Exception { } @Test - public void testDefaultMavenCommand() throws Exception { + void testDefaultMavenCommand() throws Exception { assumeTrue(Objects.nonNull(System.getProperty("maven.home")), "Test only works when maven.home is set"); mclb.build(newRequest()); @@ -862,7 +862,7 @@ public void testDefaultMavenCommand() throws Exception { } @Test - public void testAddShellEnvironment() throws Exception { + void testAddShellEnvironment() throws Exception { setupTempMavenHomeIfMissing(false); InvocationRequest request = newRequest(); diff --git a/src/test/java/org/apache/maven/shared/invoker/SystemOutHandlerTest.java b/src/test/java/org/apache/maven/shared/invoker/SystemOutHandlerTest.java index ff80abb..cf210f5 100644 --- a/src/test/java/org/apache/maven/shared/invoker/SystemOutHandlerTest.java +++ b/src/test/java/org/apache/maven/shared/invoker/SystemOutHandlerTest.java @@ -20,22 +20,22 @@ import org.junit.jupiter.api.Test; -public class SystemOutHandlerTest { +class SystemOutHandlerTest { @Test - public void testConsumeWithoutAlwaysFlush() { + void testConsumeWithoutAlwaysFlush() { logTestStart(); new SystemOutHandler(false).consumeLine("This is a test."); } @Test - public void testConsumeWithAlwaysFlush() { + void testConsumeWithAlwaysFlush() { logTestStart(); new SystemOutHandler(true).consumeLine("This is a test."); } @Test - public void testConsumeNullLine() { + void testConsumeNullLine() { logTestStart(); new SystemOutHandler().consumeLine(null); } diff --git a/src/test/java/org/apache/maven/shared/invoker/SystemOutLoggerTest.java b/src/test/java/org/apache/maven/shared/invoker/SystemOutLoggerTest.java index 33b781f..1b6dfff 100644 --- a/src/test/java/org/apache/maven/shared/invoker/SystemOutLoggerTest.java +++ b/src/test/java/org/apache/maven/shared/invoker/SystemOutLoggerTest.java @@ -26,7 +26,7 @@ import static org.junit.jupiter.api.Assertions.assertFalse; import static org.junit.jupiter.api.Assertions.assertTrue; -public class SystemOutLoggerTest { +class SystemOutLoggerTest { private static final Throwable EXCEPTION = new MalformedURLException("This is meant to happen. It's part of the test."); @@ -34,162 +34,162 @@ public class SystemOutLoggerTest { private static final String MESSAGE = "This is a test message."; @Test - public void testDebugWithMessageOnly() { + void testDebugWithMessageOnly() { logTestStart(); new SystemOutLogger().debug(MESSAGE); } @Test - public void testDebugWithMessageAndError() { + void testDebugWithMessageAndError() { logTestStart(); new SystemOutLogger().debug(MESSAGE, EXCEPTION); } @Test - public void testDebugWithNullMessageAndNoError() { + void testDebugWithNullMessageAndNoError() { logTestStart(); new SystemOutLogger().debug(null); } @Test - public void testDebugWithNullMessageError() { + void testDebugWithNullMessageError() { logTestStart(); new SystemOutLogger().debug(null, EXCEPTION); } @Test - public void testDebugWithMessageNullError() { + void testDebugWithMessageNullError() { logTestStart(); new SystemOutLogger().debug(MESSAGE, null); } @Test - public void testInfoWithMessageOnly() { + void testInfoWithMessageOnly() { logTestStart(); new SystemOutLogger().info(MESSAGE); } @Test - public void testInfoWithMessageAndError() { + void testInfoWithMessageAndError() { logTestStart(); new SystemOutLogger().info(MESSAGE, EXCEPTION); } @Test - public void testInfoWithNullMessageAndNoError() { + void testInfoWithNullMessageAndNoError() { logTestStart(); new SystemOutLogger().info(null); } @Test - public void testInfoWithNullMessageError() { + void testInfoWithNullMessageError() { logTestStart(); new SystemOutLogger().info(null, EXCEPTION); } @Test - public void testInfoWithMessageNullError() { + void testInfoWithMessageNullError() { logTestStart(); new SystemOutLogger().info(MESSAGE, null); } @Test - public void testWarnWithMessageOnly() { + void testWarnWithMessageOnly() { logTestStart(); new SystemOutLogger().warn(MESSAGE); } @Test - public void testWarnWithMessageAndError() { + void testWarnWithMessageAndError() { logTestStart(); new SystemOutLogger().warn(MESSAGE, EXCEPTION); } @Test - public void testWarnWithNullMessageAndNoError() { + void testWarnWithNullMessageAndNoError() { logTestStart(); new SystemOutLogger().warn(null); } @Test - public void testWarnWithNullMessageError() { + void testWarnWithNullMessageError() { logTestStart(); new SystemOutLogger().warn(null, EXCEPTION); } @Test - public void testWarnWithMessageNullError() { + void testWarnWithMessageNullError() { logTestStart(); new SystemOutLogger().warn(MESSAGE, null); } @Test - public void testErrorWithMessageOnly() { + void testErrorWithMessageOnly() { logTestStart(); new SystemOutLogger().error(MESSAGE); } @Test - public void testErrorWithMessageAndError() { + void testErrorWithMessageAndError() { logTestStart(); new SystemOutLogger().error(MESSAGE, EXCEPTION); } @Test - public void testErrorWithNullMessageAndNoError() { + void testErrorWithNullMessageAndNoError() { logTestStart(); new SystemOutLogger().error(null); } @Test - public void testErrorWithNullMessageError() { + void testErrorWithNullMessageError() { logTestStart(); new SystemOutLogger().error(null, EXCEPTION); } @Test - public void testErrorWithMessageNullError() { + void testErrorWithMessageNullError() { logTestStart(); new SystemOutLogger().error(MESSAGE, null); } @Test - public void testFatalErrorWithMessageOnly() { + void testFatalErrorWithMessageOnly() { logTestStart(); new SystemOutLogger().fatalError(MESSAGE); } @Test - public void testFatalErrorWithMessageAndError() { + void testFatalErrorWithMessageAndError() { logTestStart(); new SystemOutLogger().fatalError(MESSAGE, EXCEPTION); } @Test - public void testFatalErrorWithNullMessageAndNoError() { + void testFatalErrorWithNullMessageAndNoError() { logTestStart(); new SystemOutLogger().fatalError(null); } @Test - public void testFatalErrorWithNullMessageError() { + void testFatalErrorWithNullMessageError() { logTestStart(); new SystemOutLogger().fatalError(null, EXCEPTION); } @Test - public void testFatalErrorWithMessageNullError() { + void testFatalErrorWithMessageNullError() { logTestStart(); new SystemOutLogger().fatalError(MESSAGE, null); } @Test - public void testDefaultThresholdInfo() { + void testDefaultThresholdInfo() { assertEquals(InvokerLogger.INFO, new SystemOutLogger().getThreshold()); } @Test - public void testThresholdDebug() { + void testThresholdDebug() { InvokerLogger logger = new SystemOutLogger(); logger.setThreshold(InvokerLogger.DEBUG); assertTrue(logger.isDebugEnabled()); @@ -200,7 +200,7 @@ public void testThresholdDebug() { } @Test - public void testThresholdInfo() { + void testThresholdInfo() { InvokerLogger logger = new SystemOutLogger(); logger.setThreshold(InvokerLogger.INFO); assertFalse(logger.isDebugEnabled()); @@ -211,7 +211,7 @@ public void testThresholdInfo() { } @Test - public void testThresholdWarn() { + void testThresholdWarn() { InvokerLogger logger = new SystemOutLogger(); logger.setThreshold(InvokerLogger.WARN); assertFalse(logger.isDebugEnabled()); @@ -222,7 +222,7 @@ public void testThresholdWarn() { } @Test - public void testThresholdError() { + void testThresholdError() { InvokerLogger logger = new SystemOutLogger(); logger.setThreshold(InvokerLogger.ERROR); assertFalse(logger.isDebugEnabled()); @@ -233,7 +233,7 @@ public void testThresholdError() { } @Test - public void testThresholdFatal() { + void testThresholdFatal() { InvokerLogger logger = new SystemOutLogger(); logger.setThreshold(InvokerLogger.FATAL); assertFalse(logger.isDebugEnabled());