You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ant.apache.org by gs...@apache.org on 2009/01/22 22:06:08 UTC

svn commit: r736794 - /ant/antlibs/antunit/trunk/src/main/org/apache/ant/antunit/AntUnit.java

Author: gscokart
Date: Thu Jan 22 13:06:08 2009
New Revision: 736794

URL: http://svn.apache.org/viewvc?rev=736794&view=rev
Log:
move more code in AntUnitScriptRunner

Modified:
    ant/antlibs/antunit/trunk/src/main/org/apache/ant/antunit/AntUnit.java

Modified: ant/antlibs/antunit/trunk/src/main/org/apache/ant/antunit/AntUnit.java
URL: http://svn.apache.org/viewvc/ant/antlibs/antunit/trunk/src/main/org/apache/ant/antunit/AntUnit.java?rev=736794&r1=736793&r2=736794&view=diff
==============================================================================
--- ant/antlibs/antunit/trunk/src/main/org/apache/ant/antunit/AntUnit.java (original)
+++ ant/antlibs/antunit/trunk/src/main/org/apache/ant/antunit/AntUnit.java Thu Jan 22 13:06:08 2009
@@ -71,31 +71,6 @@
         "Only file system resources are supported.";
 
     /**
-     * name of the magic setUp target.
-     */
-    private static final String SETUP = "setUp";
-
-    /**
-     * prefix that identifies test targets.
-     */
-    private static final String TEST = "test";
-
-    /**
-     * name of the magic tearDown target.
-     */
-    private static final String TEARDOWN = "tearDown";
-    
-    /**
-     * name of the magic suiteSetUp target.
-     */
-    private static final String SUITESETUP = "suiteSetUp";
-    
-    /**
-     * name of the magic suiteTearDown target.
-     */
-    private static final String SUITETEARDOWN = "suiteTearDown";
-
-    /**
      * The build files to process.
      */
     private Union buildFiles;
@@ -224,6 +199,31 @@
     }
 
     private class AntUnitScriptRunner {
+        /**
+         * name of the magic setUp target.
+         */
+        private static final String SETUP = "setUp";
+
+        /**
+         * prefix that identifies test targets.
+         */
+        private static final String TEST = "test";
+
+        /**
+         * name of the magic tearDown target.
+         */
+        private static final String TEARDOWN = "tearDown";
+        
+        /**
+         * name of the magic suiteSetUp target.
+         */
+        private static final String SUITESETUP = "suiteSetUp";
+        
+        /**
+         * name of the magic suiteTearDown target.
+         */
+        private static final String SUITETEARDOWN = "suiteTearDown";
+
         private boolean setUp;
         private boolean tearDown;
         private boolean suiteSetUp;
@@ -316,7 +316,29 @@
                 }
             }
             newProject.fireBuildFinished(caught);
-        }    
+        }
+        
+        /** Report a failure or an exception for the test target name */
+        private void fireFailOrError(String name, BuildException e) {
+            boolean failed = false;
+            // try to see whether the BuildException masks
+            // an AssertionFailedException. If so, treat
+            // it as failure instead of error.
+            Throwable t = e.getCause();
+            while (t != null && t instanceof BuildException) {
+                if (t instanceof AssertionFailedException) {
+                    failed = true;
+                    fireFail(name, (AssertionFailedException) t);
+                    break;
+                }
+                t = ((BuildException) t).getCause();
+            }
+
+            if (!failed) {
+                fireError(name, e);
+            }
+        }
+
     }
     
     /**
@@ -349,27 +371,6 @@
         }
     }
 
-	
-    /** Report a failure or an exception for the test target name */
-    private void fireFailOrError(String name, BuildException e) {
-		boolean failed = false;
-		// try to see whether the BuildException masks
-		// an AssertionFailedException. If so, treat
-		// it as failure instead of error.
-		Throwable t = e.getCause();
-		while (t != null && t instanceof BuildException) {
-		    if (t instanceof AssertionFailedException) {
-		        failed = true;
-		        fireFail(name, (AssertionFailedException) t);
-		        break;
-		    }
-		    t = ((BuildException) t).getCause();
-		}
-
-		if (!failed) {
-		    fireError(name, e);
-		}
-	}
 
     /**
      * Redirect output to new project instance.