You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by GitBox <gi...@apache.org> on 2020/02/24 08:58:44 UTC
[GitHub] [maven-shared-utils] Tibor17 commented on a change in pull request
#10: fix a number of small warnings and formatting issues
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:
users@infra.apache.org
With regards,
Apache Git Services