You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by jv...@apache.org on 2009/07/23 00:56:40 UTC

svn commit: r796902 - /maven/core-integration-testing/trunk/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng1830ShowVersionTest.java

Author: jvanzyl
Date: Wed Jul 22 22:56:39 2009
New Revision: 796902

URL: http://svn.apache.org/viewvc?rev=796902&view=rev
Log:
o loop through the lines as the emma enabled tests have some extra lines added and throw off the hard coded search for the second line

Modified:
    maven/core-integration-testing/trunk/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng1830ShowVersionTest.java

Modified: maven/core-integration-testing/trunk/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng1830ShowVersionTest.java
URL: http://svn.apache.org/viewvc/maven/core-integration-testing/trunk/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng1830ShowVersionTest.java?rev=796902&r1=796901&r2=796902&view=diff
==============================================================================
--- maven/core-integration-testing/trunk/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng1830ShowVersionTest.java (original)
+++ maven/core-integration-testing/trunk/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng1830ShowVersionTest.java Wed Jul 22 22:56:39 2009
@@ -23,6 +23,7 @@
 import java.text.SimpleDateFormat;
 import java.util.Collections;
 import java.util.Date;
+import java.util.Iterator;
 import java.util.List;
 
 import org.apache.maven.it.util.ResourceExtractor;
@@ -57,14 +58,24 @@
         verifier.executeGoal( "validate" );
         verifier.verifyErrorFreeLog();
         verifier.resetStreams();
-
-        String line = (String) verifier.loadFile( verifier.getBasedir(), verifier.getLogFileName(), false ).get( 1 );
-        assertTrue( line, line.matches( "^Apache Maven (.*?) \\(r[0-9]+; .*\\)$" ) || line.matches( "^Apache Maven (.*?) \\(rNON-CANONICAL_[-_0-9]+.+?; .*\\)$" ) );
-
-        // check timestamp parses
-        String timestamp = line.substring( line.lastIndexOf( ';' ) + 1, line.length() - 1 ).trim();
-        SimpleDateFormat fmt = new SimpleDateFormat( "yyyy-MM-dd HH:mm:ssZ" );
-        Date date = fmt.parse( timestamp );
-        assertEquals( timestamp, fmt.format( date ) );
+                       
+        boolean apacheVersionInTheRightFormatWasFound = false;
+        List lines = verifier.loadFile( verifier.getBasedir(), verifier.getLogFileName(), false );
+        for( Iterator i = lines.iterator(); i.hasNext(); )
+        {
+            String line = (String) i.next();
+            if ( line.matches( "^Apache Maven (.*?) \\(r[0-9]+; .*\\)$" ) ||  line.matches( "^Apache Maven (.*?) \\(rNON-CANONICAL_[-_0-9]+.+?; .*\\)$" ) )
+            {
+                apacheVersionInTheRightFormatWasFound = true;
+                // check timestamp parses
+                String timestamp = line.substring( line.lastIndexOf( ';' ) + 1, line.length() - 1 ).trim();
+                SimpleDateFormat fmt = new SimpleDateFormat( "yyyy-MM-dd HH:mm:ssZ" );
+                Date date = fmt.parse( timestamp );
+                assertEquals( timestamp, fmt.format( date ) );
+                break;
+            }
+        }
+        
+        assertTrue( apacheVersionInTheRightFormatWasFound );
     }
 }