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/10/04 11:55:37 UTC

[GitHub] [maven-stage-plugin] elharo opened a new pull request #4: use Java 7 file handling in test

elharo opened a new pull request #4:
URL: https://github.com/apache/maven-stage-plugin/pull/4


   


----------------------------------------------------------------
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



[GitHub] [maven-stage-plugin] elharo commented on a change in pull request #4: use Java 7 file handling in test

Posted by GitBox <gi...@apache.org>.
elharo commented on a change in pull request #4:
URL: https://github.com/apache/maven-stage-plugin/pull/4#discussion_r499240665



##########
File path: src/test/java/org/apache/maven/plugins/stage/RepositoryCopierTest.java
##########
@@ -103,28 +103,28 @@ private void testMavenArtifact( File repo, String artifact )
 
         assertTrue( versionDir.exists() );
 
-        Reader r = new FileReader( new File( basedir, RepositoryCopier.MAVEN_METADATA) );
-
-        Metadata metadata = reader.read( r );
-
-        // Make sure our new versions has been setup as the release.
-        assertEquals( version, metadata.getVersioning().getRelease() );
-
-        assertEquals( "20070327020553", metadata.getVersioning().getLastUpdated() );
-
-        // Make sure we didn't whack old versions.
-        List versions = metadata.getVersioning().getVersions();
-
-        assertTrue( versions.contains( "2.0.1" ) );
-
-        assertTrue( versions.contains( "2.0.2" ) );
-
-        assertTrue( versions.contains( "2.0.3" ) );
-        
-        assertTrue( versions.contains( "2.0.4" ) );
-
-        assertTrue( versions.contains( "2.0.5" ) );
-
-        r.close();
+        File file = new File( basedir, RepositoryCopier.MAVEN_METADATA);
+        try ( Reader r = new InputStreamReader ( new FileInputStream( file ), StandardCharsets.UTF_8 ) )

Review comment:
       done

##########
File path: src/test/java/org/apache/maven/plugins/stage/RepositoryCopierTest.java
##########
@@ -103,28 +103,28 @@ private void testMavenArtifact( File repo, String artifact )
 
         assertTrue( versionDir.exists() );
 
-        Reader r = new FileReader( new File( basedir, RepositoryCopier.MAVEN_METADATA) );
-
-        Metadata metadata = reader.read( r );
-
-        // Make sure our new versions has been setup as the release.
-        assertEquals( version, metadata.getVersioning().getRelease() );
-
-        assertEquals( "20070327020553", metadata.getVersioning().getLastUpdated() );
-
-        // Make sure we didn't whack old versions.
-        List versions = metadata.getVersioning().getVersions();
-
-        assertTrue( versions.contains( "2.0.1" ) );
-
-        assertTrue( versions.contains( "2.0.2" ) );
-
-        assertTrue( versions.contains( "2.0.3" ) );
-        
-        assertTrue( versions.contains( "2.0.4" ) );
-
-        assertTrue( versions.contains( "2.0.5" ) );
-
-        r.close();
+        File file = new File( basedir, RepositoryCopier.MAVEN_METADATA);

Review comment:
       fixed




----------------------------------------------------------------
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



[GitHub] [maven-stage-plugin] michael-o commented on a change in pull request #4: use Java 7 file handling in test

Posted by GitBox <gi...@apache.org>.
michael-o commented on a change in pull request #4:
URL: https://github.com/apache/maven-stage-plugin/pull/4#discussion_r499239085



##########
File path: src/test/java/org/apache/maven/plugins/stage/RepositoryCopierTest.java
##########
@@ -103,28 +103,28 @@ private void testMavenArtifact( File repo, String artifact )
 
         assertTrue( versionDir.exists() );
 
-        Reader r = new FileReader( new File( basedir, RepositoryCopier.MAVEN_METADATA) );
-
-        Metadata metadata = reader.read( r );
-
-        // Make sure our new versions has been setup as the release.
-        assertEquals( version, metadata.getVersioning().getRelease() );
-
-        assertEquals( "20070327020553", metadata.getVersioning().getLastUpdated() );
-
-        // Make sure we didn't whack old versions.
-        List versions = metadata.getVersioning().getVersions();
-
-        assertTrue( versions.contains( "2.0.1" ) );
-
-        assertTrue( versions.contains( "2.0.2" ) );
-
-        assertTrue( versions.contains( "2.0.3" ) );
-        
-        assertTrue( versions.contains( "2.0.4" ) );
-
-        assertTrue( versions.contains( "2.0.5" ) );
-
-        r.close();
+        File file = new File( basedir, RepositoryCopier.MAVEN_METADATA);
+        try ( Reader r = new InputStreamReader ( new FileInputStream( file ), StandardCharsets.UTF_8 ) )

Review comment:
       Why now `Files.newBufferedReader()`?

##########
File path: src/test/java/org/apache/maven/plugins/stage/RepositoryCopierTest.java
##########
@@ -103,28 +103,28 @@ private void testMavenArtifact( File repo, String artifact )
 
         assertTrue( versionDir.exists() );
 
-        Reader r = new FileReader( new File( basedir, RepositoryCopier.MAVEN_METADATA) );
-
-        Metadata metadata = reader.read( r );
-
-        // Make sure our new versions has been setup as the release.
-        assertEquals( version, metadata.getVersioning().getRelease() );
-
-        assertEquals( "20070327020553", metadata.getVersioning().getLastUpdated() );
-
-        // Make sure we didn't whack old versions.
-        List versions = metadata.getVersioning().getVersions();
-
-        assertTrue( versions.contains( "2.0.1" ) );
-
-        assertTrue( versions.contains( "2.0.2" ) );
-
-        assertTrue( versions.contains( "2.0.3" ) );
-        
-        assertTrue( versions.contains( "2.0.4" ) );
-
-        assertTrue( versions.contains( "2.0.5" ) );
-
-        r.close();
+        File file = new File( basedir, RepositoryCopier.MAVEN_METADATA);

Review comment:
       Space missing




----------------------------------------------------------------
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



[GitHub] [maven-stage-plugin] elharo merged pull request #4: [MSTAGE-25] use Java 7 file handling in test

Posted by GitBox <gi...@apache.org>.
elharo merged pull request #4:
URL: https://github.com/apache/maven-stage-plugin/pull/4


   


----------------------------------------------------------------
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