You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tomee.apache.org by db...@apache.org on 2006/12/04 20:53:07 UTC

svn commit: r482322 - in /incubator/openejb/branches/v2_2/openejb2/itests/openejb-itests-core/src/test/java/org/apache/openejb/test: DummyTest.java NumberedTestCase.java

Author: dblevins
Date: Mon Dec  4 11:53:05 2006
New Revision: 482322

URL: http://svn.apache.org/viewvc?view=rev&rev=482322
Log:
Compute the test name in the NumberedTestCase class

Modified:
    incubator/openejb/branches/v2_2/openejb2/itests/openejb-itests-core/src/test/java/org/apache/openejb/test/DummyTest.java
    incubator/openejb/branches/v2_2/openejb2/itests/openejb-itests-core/src/test/java/org/apache/openejb/test/NumberedTestCase.java

Modified: incubator/openejb/branches/v2_2/openejb2/itests/openejb-itests-core/src/test/java/org/apache/openejb/test/DummyTest.java
URL: http://svn.apache.org/viewvc/incubator/openejb/branches/v2_2/openejb2/itests/openejb-itests-core/src/test/java/org/apache/openejb/test/DummyTest.java?view=diff&rev=482322&r1=482321&r2=482322
==============================================================================
--- incubator/openejb/branches/v2_2/openejb2/itests/openejb-itests-core/src/test/java/org/apache/openejb/test/DummyTest.java (original)
+++ incubator/openejb/branches/v2_2/openejb2/itests/openejb-itests-core/src/test/java/org/apache/openejb/test/DummyTest.java Mon Dec  4 11:53:05 2006
@@ -24,14 +24,13 @@
  * 
  */
 public class DummyTest implements Test {
-    private String method;
 
-    private int count;
+    private String name;
 
-    protected static final String standardPrefix = "test##_";
+    private int count;
 
     public DummyTest(String method, int i) {
-        this.method = method;
+        this.name = method;
         this.count = i;
     }
 
@@ -43,27 +42,12 @@
     }
 
     public String toString() {
-        return name() + removePrefix(method);
+        return getName();
     }
 
     public String getName() {
-        return name();
-    }
-
-    public String name() {
-        return "";
+        return name;
     }
 
-
-    protected static String removePrefix(String methodname) {
-        return removePrefix(standardPrefix, methodname);
-    }
-
-    protected static String removePrefix(String prefix, String methodname) {
-        if (methodname.startsWith(standardPrefix)) {
-            return methodname.substring(prefix.length());
-        }
-        return methodname;
-    }
 }
 

Modified: incubator/openejb/branches/v2_2/openejb2/itests/openejb-itests-core/src/test/java/org/apache/openejb/test/NumberedTestCase.java
URL: http://svn.apache.org/viewvc/incubator/openejb/branches/v2_2/openejb2/itests/openejb-itests-core/src/test/java/org/apache/openejb/test/NumberedTestCase.java?view=diff&rev=482322&r1=482321&r2=482322
==============================================================================
--- incubator/openejb/branches/v2_2/openejb2/itests/openejb-itests-core/src/test/java/org/apache/openejb/test/NumberedTestCase.java (original)
+++ incubator/openejb/branches/v2_2/openejb2/itests/openejb-itests-core/src/test/java/org/apache/openejb/test/NumberedTestCase.java Mon Dec  4 11:53:05 2006
@@ -93,9 +93,7 @@
         try {
             setUp();
         } catch (Exception e) {
-            DummyTest test = new DummyTest(".setup()", 0);
-
-            result.addError(test, e);
+            result.addError(new DummyTest(".setUp()", 0), e);
             return;
         }
         for (int i = 0; i < testMethods.length; i++) {
@@ -104,10 +102,7 @@
         try {
             tearDown();
         } catch (Exception e) {
-
-            DummyTest test = new DummyTest(".teardown()", 0);
-
-            result.addError(test, e);
+            result.addError(new DummyTest(".tearDown()", 0), e);
             return;
         }
     }
@@ -126,9 +121,7 @@
 
 
     protected Test createTest(final Method testMethod) {
-        DummyTest test = new DummyTest(testMethod.getName(), 1);
-
-        return test;
+        return new DummyTest(createTestName(testMethod), 1);
     }
 
     protected void runTestMethod(Method testMethod) throws Throwable {
@@ -156,7 +149,6 @@
         return "";
     }
 
-    /*
     protected String createTestName(Method testMethod) {
         return name() + removePrefix(testMethod.getName());
     }
@@ -168,7 +160,6 @@
     protected static String removePrefix(String prefix, String name) {
         return name.substring(prefix.length());
     }
-    */
 }