You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jmeter-dev@jakarta.apache.org by wo...@apache.org on 2006/05/26 16:18:16 UTC

svn commit: r409673 - /jakarta/jmeter/branches/rel-2-1/src/junit/org/apache/jmeter/protocol/java/sampler/JUnitSampler.java

Author: woolfel
Date: Fri May 26 07:18:16 2006
New Revision: 409673

URL: http://svn.apache.org/viewvc?rev=409673&view=rev
Log:
added try/catch to the setup method so that the sampler captures any failures.
peter

Modified:
    jakarta/jmeter/branches/rel-2-1/src/junit/org/apache/jmeter/protocol/java/sampler/JUnitSampler.java

Modified: jakarta/jmeter/branches/rel-2-1/src/junit/org/apache/jmeter/protocol/java/sampler/JUnitSampler.java
URL: http://svn.apache.org/viewvc/jakarta/jmeter/branches/rel-2-1/src/junit/org/apache/jmeter/protocol/java/sampler/JUnitSampler.java?rev=409673&r1=409672&r2=409673&view=diff
==============================================================================
--- jakarta/jmeter/branches/rel-2-1/src/junit/org/apache/jmeter/protocol/java/sampler/JUnitSampler.java (original)
+++ jakarta/jmeter/branches/rel-2-1/src/junit/org/apache/jmeter/protocol/java/sampler/JUnitSampler.java Fri May 26 07:18:16 2006
@@ -22,6 +22,7 @@
 import java.lang.reflect.Modifier;
 import java.util.Enumeration;
 
+import junit.framework.AssertionFailedError;
 import junit.framework.ComparisonFailure;
 import junit.framework.Protectable;
 import junit.framework.TestCase;
@@ -345,7 +346,18 @@
             try {
                 
                 if (!getDoNotSetUpTearDown() && SETUP_METHOD != null){
-                    SETUP_METHOD.invoke(this.TEST_INSTANCE,new Class[0]);
+                    try {
+                        SETUP_METHOD.invoke(this.TEST_INSTANCE,new Class[0]);
+                    } catch (InvocationTargetException e) {
+                        tr.addFailure(this.TEST_INSTANCE, 
+                                new AssertionFailedError(e.getMessage()));
+                    } catch (IllegalAccessException e) {
+                        tr.addFailure(this.TEST_INSTANCE, 
+                                new AssertionFailedError(e.getMessage()));
+                    } catch (IllegalArgumentException e) {
+                        tr.addFailure(this.TEST_INSTANCE, 
+                                new AssertionFailedError(e.getMessage()));
+                    }
                 }
                 final Method m = getMethod(this.TEST_INSTANCE,getMethod());
                 final TestCase theClazz = this.TEST_INSTANCE;



---------------------------------------------------------------------
To unsubscribe, e-mail: jmeter-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jmeter-dev-help@jakarta.apache.org