Tibor17 commented on a change in pull request #10: fix a number of small
warnings and formatting issues
URL: https://github.com/apache/maven-shared-utils/pull/10#discussion_r383140634
##########
File path: src/test/java/org/apache/maven/shared/utils/ExpandTest.java
##########
@@ -326,11 +326,11 @@ private void verifyExpandedFileAndContent( File
targetDir, String expectedConten
assertNotNull( expandedFile );
- java.util.Scanner scanner = new java.util.Scanner( expandedFile
).useDelimiter( "\n" );
- String text = scanner.next();
-
- assertThat( "expanded file content must match"
- , text
- , is( expectedContent ) );
+ try (Scanner base = new Scanner( expandedFile );
+ Scanner scanner = base.useDelimiter( "\n" ) )
Review comment:
Having two local variables with the same reference is not necessary. It is
the flow design:
https://docs.oracle.com/javase/7/docs/api/java/util/Scanner.html#useDelimiter(java.util.regex.Pattern)
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services