Author: skitching
Date: Tue Jul  5 23:28:24 2005
New Revision: 209414

URL: http://svn.apache.org/viewcvs?rev=209414&view=rev
Log:
Move duplicated testResetContext tests out of ParentFirst and ChildFirst into 
GeneralTestCase.

Modified:
    
jakarta/commons/proper/logging/trunk/src/test/org/apache/commons/logging/pathable/ChildFirstTestCase.java
    
jakarta/commons/proper/logging/trunk/src/test/org/apache/commons/logging/pathable/GeneralTestCase.java
    
jakarta/commons/proper/logging/trunk/src/test/org/apache/commons/logging/pathable/ParentFirstTestCase.java

Modified: 
jakarta/commons/proper/logging/trunk/src/test/org/apache/commons/logging/pathable/ChildFirstTestCase.java
URL: 
http://svn.apache.org/viewcvs/jakarta/commons/proper/logging/trunk/src/test/org/apache/commons/logging/pathable/ChildFirstTestCase.java?rev=209414&r1=209413&r2=209414&view=diff
==============================================================================
--- 
jakarta/commons/proper/logging/trunk/src/test/org/apache/commons/logging/pathable/ChildFirstTestCase.java
 (original)
+++ 
jakarta/commons/proper/logging/trunk/src/test/org/apache/commons/logging/pathable/ChildFirstTestCase.java
 Tue Jul  5 23:28:24 2005
@@ -281,40 +281,4 @@
         // but with different contents. That's a little tricky to set up so 
we'll
         // skip that for now.
     }
-    
-    /**
-     * Verify that the context classloader is a custom one, then reset it to
-     * a non-custom one.
-     */
-    private static void checkAndSetContext() {
-        ClassLoader contextLoader = 
Thread.currentThread().getContextClassLoader();
-        assertEquals("ContextLoader is of unexpected type", 
-                contextLoader.getClass().getName(), 
-                PathableClassLoader.class.getName());
-        
-        URL[] noUrls = new URL[0];
-        Thread.currentThread().setContextClassLoader(new 
URLClassLoader(noUrls));
-    }
-    
-    /**
-     * Verify that when a test method modifies the context classloader it is
-     * reset before the next test is run.
-     * <p>
-     * This method works in conjunction with testResetContext2. There is no
-     * way of knowing which test method junit will run first, but it doesn't
-     * matter; whichever one of them runs first will modify the 
contextClassloader.
-     * If the PathableTestSuite isn't resetting the contextClassLoader then 
whichever
-     * of them runs second will fail. Of course if other methods are run 
in-between
-     * then those methods might also fail...
-     */
-    public void testResetContext1() {
-        checkAndSetContext();
-    }
-
-    /**
-     * See testResetContext1.
-     */
-    public void testResetContext2() {
-        checkAndSetContext();
-    }
 }

Modified: 
jakarta/commons/proper/logging/trunk/src/test/org/apache/commons/logging/pathable/GeneralTestCase.java
URL: 
http://svn.apache.org/viewcvs/jakarta/commons/proper/logging/trunk/src/test/org/apache/commons/logging/pathable/GeneralTestCase.java?rev=209414&r1=209413&r2=209414&view=diff
==============================================================================
--- 
jakarta/commons/proper/logging/trunk/src/test/org/apache/commons/logging/pathable/GeneralTestCase.java
 (original)
+++ 
jakarta/commons/proper/logging/trunk/src/test/org/apache/commons/logging/pathable/GeneralTestCase.java
 Tue Jul  5 23:28:24 2005
@@ -83,4 +83,40 @@
     public void testResetProps2() {
         checkAndSetProperties();
     }
+    
+    /**
+     * Verify that the context classloader is a custom one, then reset it to
+     * a non-custom one.
+     */
+    private static void checkAndSetContext() {
+        ClassLoader contextLoader = 
Thread.currentThread().getContextClassLoader();
+        assertEquals("ContextLoader is of unexpected type", 
+                contextLoader.getClass().getName(), 
+                PathableClassLoader.class.getName());
+        
+        URL[] noUrls = new URL[0];
+        Thread.currentThread().setContextClassLoader(new 
URLClassLoader(noUrls));
+    }
+    
+    /**
+     * Verify that when a test method modifies the context classloader it is
+     * reset before the next test is run.
+     * <p>
+     * This method works in conjunction with testResetContext2. There is no
+     * way of knowing which test method junit will run first, but it doesn't
+     * matter; whichever one of them runs first will modify the 
contextClassloader.
+     * If the PathableTestSuite isn't resetting the contextClassLoader then 
whichever
+     * of them runs second will fail. Of course if other methods are run 
in-between
+     * then those methods might also fail...
+     */
+    public void testResetContext1() {
+        checkAndSetContext();
+    }
+
+    /**
+     * See testResetContext1.
+     */
+    public void testResetContext2() {
+        checkAndSetContext();
+    }
 }

Modified: 
jakarta/commons/proper/logging/trunk/src/test/org/apache/commons/logging/pathable/ParentFirstTestCase.java
URL: 
http://svn.apache.org/viewcvs/jakarta/commons/proper/logging/trunk/src/test/org/apache/commons/logging/pathable/ParentFirstTestCase.java?rev=209414&r1=209413&r2=209414&view=diff
==============================================================================
--- 
jakarta/commons/proper/logging/trunk/src/test/org/apache/commons/logging/pathable/ParentFirstTestCase.java
 (original)
+++ 
jakarta/commons/proper/logging/trunk/src/test/org/apache/commons/logging/pathable/ParentFirstTestCase.java
 Tue Jul  5 23:28:24 2005
@@ -278,40 +278,4 @@
         // but with different contents. That's a little tricky to set up so 
we'll
         // skip that for now.
     }
-    
-    /**
-     * Verify that the context classloader is a custom one, then reset it to
-     * a non-custom one.
-     */
-    private static void checkAndSetContext() {
-        ClassLoader contextLoader = 
Thread.currentThread().getContextClassLoader();
-        assertEquals("ContextLoader is of unexpected type", 
-                contextLoader.getClass().getName(), 
-                PathableClassLoader.class.getName());
-        
-        URL[] noUrls = new URL[0];
-        Thread.currentThread().setContextClassLoader(new 
URLClassLoader(noUrls));
-    }
-    
-    /**
-     * Verify that when a test method modifies the context classloader it is
-     * reset before the next test is run.
-     * <p>
-     * This method works in conjunction with testResetContext2. There is no
-     * way of knowing which test method junit will run first, but it doesn't
-     * matter; whichever one of them runs first will modify the 
contextClassloader.
-     * If the PathableTestSuite isn't resetting the contextClassLoader then 
whichever
-     * of them runs second will fail. Of course if other methods are run 
in-between
-     * then those methods might also fail...
-     */
-    public void testResetContext1() {
-        checkAndSetContext();
-    }
-
-    /**
-     * See testResetContext1.
-     */
-    public void testResetContext2() {
-        checkAndSetContext();
-    }
 }



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to