You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by sk...@apache.org on 2005/05/23 03:41:24 UTC

svn commit: r177867 - /jakarta/commons/proper/logging/trunk/src/test/org/apache/commons/logging/jdk14/CustomConfigTestCase.java

Author: skitching
Date: Sun May 22 18:41:23 2005
New Revision: 177867

URL: http://svn.apache.org/viewcvs?rev=177867&view=rev
Log:
Add better reporting when jdk14 handler setup isn't right.

Modified:
    jakarta/commons/proper/logging/trunk/src/test/org/apache/commons/logging/jdk14/CustomConfigTestCase.java

Modified: jakarta/commons/proper/logging/trunk/src/test/org/apache/commons/logging/jdk14/CustomConfigTestCase.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/logging/trunk/src/test/org/apache/commons/logging/jdk14/CustomConfigTestCase.java?rev=177867&r1=177866&r2=177867&view=diff
==============================================================================
--- jakarta/commons/proper/logging/trunk/src/test/org/apache/commons/logging/jdk14/CustomConfigTestCase.java (original)
+++ jakarta/commons/proper/logging/trunk/src/test/org/apache/commons/logging/jdk14/CustomConfigTestCase.java Sun May 22 18:41:23 2005
@@ -276,10 +276,24 @@
             parent = parent.getParent();
         }
         handlers = parent.getHandlers();
-        if ((handlers != null) && (handlers.length == 1) &&
-            (handlers[0] instanceof TestHandler)) {
-            handler = (TestHandler) handlers[0];
-        }
+        
+        // The CustomConfig.properties file explicitly defines one handler class
+        // to be attached to the root logger, so if it isn't there then 
+        // something is badly wrong...
+        //
+        // Yes this testing is also done in testPristineHandlers but
+        // unfortunately:
+        //  * we need to set up the handlers variable here, 
+        //  * we don't want that to be set up incorrectly, as that can
+        //    produce weird error messages in other tests, and
+        //  * we can't rely on testPristineHandlers being the first
+        //    test to run.
+        // so we need to test things here too.
+        assertNotNull("No Handlers defined for JDK14 logging", handlers);
+        assertEquals("Unexpected number of handlers for JDK14 logging", 1, handlers.length);
+        assertNotNull("Handler is null", handlers[0]);
+        assertTrue("Handler not of expected type", handlers[0] instanceof TestHandler);
+        handler = (TestHandler) handlers[0];
     }
 
 



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