michael-o commented on code in PR #41:
URL: https://github.com/apache/maven-verifier/pull/41#discussion_r963360482
##########
src/main/java/org/apache/maven/shared/verifier/Verifier.java:
##########
@@ -1237,20 +1237,9 @@ public void executeGoals( List<String> goals,
Map<String, String> envVars )
File logFile = new File( getBasedir(), getLogFileName() );
- for ( Object cliOption : cliOptions )
+ for ( String cliOption : cliOptions )
{
- String key = String.valueOf( cliOption );
-
- String resolvedArg = resolveCommandLineArg( key );
-
- try
- {
- args.addAll( Arrays.asList(
CommandLineUtils.translateCommandline( resolvedArg ) ) );
- }
- catch ( Exception e )
- {
- e.printStackTrace();
- }
+ args.add( resolveCommandLineArg( cliOption ) );
Review Comment:
I believe that most quoting here is not necessary anymore:
`resolveCommandLineArg()`
##########
src/test/java/org/apache/maven/shared/verifier/VerifierTest.java:
##########
@@ -130,4 +139,74 @@ void testDefaultFilterMap() throws VerificationException
assertTrue( filterMap.containsKey( "@basedir@" ) );
assertTrue( filterMap.containsKey( "@baseurl@" ) );
}
+
+ @Test
+ void testDefaultMavenArgument() throws VerificationException
+ {
+ TestVerifier verifier = new TestVerifier( "src/test/resources" );
+
+ verifier.executeGoal( "test" );
+
+ assertThat( verifier.launcher.cliArgs, arrayContaining(
+ "-e", "--batch-mode", "-Dmaven.repo.local=test-local-repo",
+ "org.apache.maven.plugins:maven-clean-plugin:clean", "test" ) );
+ }
+
+ public static Stream<Arguments> argumentsForTest()
+ {
+ return Stream.of(
+ arguments( "test-argument", "test-argument" ),
+ arguments( "test/${basedir}/test", "test/src/test/resources/test"
),
+ arguments( "argument with space", "argument with space" )
+ );
+ }
+
+ @ParameterizedTest
+ @MethodSource( "argumentsForTest" )
+ void argumentShouldBePassAsIs(String inputArgument, String
expectedArgument) throws VerificationException
Review Comment:
`...Passed`
##########
src/test/java/org/apache/maven/shared/verifier/VerifierTest.java:
##########
@@ -130,4 +139,74 @@ void testDefaultFilterMap() throws VerificationException
assertTrue( filterMap.containsKey( "@basedir@" ) );
assertTrue( filterMap.containsKey( "@baseurl@" ) );
}
+
+ @Test
+ void testDefaultMavenArgument() throws VerificationException
+ {
+ TestVerifier verifier = new TestVerifier( "src/test/resources" );
+
+ verifier.executeGoal( "test" );
+
+ assertThat( verifier.launcher.cliArgs, arrayContaining(
+ "-e", "--batch-mode", "-Dmaven.repo.local=test-local-repo",
+ "org.apache.maven.plugins:maven-clean-plugin:clean", "test" ) );
+ }
+
+ public static Stream<Arguments> argumentsForTest()
+ {
+ return Stream.of(
+ arguments( "test-argument", "test-argument" ),
+ arguments( "test/${basedir}/test", "test/src/test/resources/test"
),
+ arguments( "argument with space", "argument with space" )
+ );
+ }
+
+ @ParameterizedTest
+ @MethodSource( "argumentsForTest" )
+ void argumentShouldBePassAsIs(String inputArgument, String
expectedArgument) throws VerificationException
Review Comment:
line formatting
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]