Author: snicoll
Date: Wed Dec 27 03:12:04 2006
New Revision: 490479

URL: http://svn.apache.org/viewvc?view=rev&rev=490479
Log:
Fixed test failure on linux and macOSx when the build is expected to fail.

Modified:
    
maven/plugins/trunk/maven-ear-plugin/src/test/java/org/apache/maven/plugin/ear/AbstractEarPluginTestCase.java

Modified: 
maven/plugins/trunk/maven-ear-plugin/src/test/java/org/apache/maven/plugin/ear/AbstractEarPluginTestCase.java
URL: 
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-ear-plugin/src/test/java/org/apache/maven/plugin/ear/AbstractEarPluginTestCase.java?view=diff&rev=490479&r1=490478&r2=490479
==============================================================================
--- 
maven/plugins/trunk/maven-ear-plugin/src/test/java/org/apache/maven/plugin/ear/AbstractEarPluginTestCase.java
 (original)
+++ 
maven/plugins/trunk/maven-ear-plugin/src/test/java/org/apache/maven/plugin/ear/AbstractEarPluginTestCase.java
 Wed Dec 27 03:12:04 2006
@@ -21,6 +21,7 @@
 
 import junit.framework.TestCase;
 import org.apache.maven.it.Verifier;
+import org.apache.maven.it.VerificationException;
 import org.apache.maven.it.util.ResourceExtractor;
 import org.custommonkey.xmlunit.XMLAssert;
 
@@ -76,7 +77,20 @@
         // Let's add alternate settings.xml setting so that the latest 
dependencies are used
         verifier.getCliOptions().add( "-s " + settingsFile.getAbsolutePath() );
         verifier.localRepo = localRepositoryDir.getAbsolutePath();
-        verifier.executeGoal( "package" );
+
+        // On linux and macOSX, an exception is thrown if a build failure 
occurs underneath
+        try
+        {
+            verifier.executeGoal( "package" );
+        }
+        catch ( VerificationException e )
+        {
+            //@TODO needs to be handled nicely in the verifier
+            if (expectNoError || e.getMessage().indexOf( "Exit code was 
non-zero") == -1) {
+                throw e;
+            }
+        }
+
         // If no error is expected make sure that error logs are free
         if ( expectNoError )
         {


Reply via email to