cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From reinh...@apache.org
Subject svn commit: r159020 - in cocoon/whiteboard/block-deployer/test/junit/org/apache/cocoon/blockdeployer/logging: ./ ConsoleLoggerTest.java
Date Fri, 25 Mar 2005 14:14:35 GMT
Author: reinhard
Date: Fri Mar 25 06:14:34 2005
New Revision: 159020

URL: http://svn.apache.org/viewcvs?view=rev&rev=159020
Log:
add test for ConsoleLogger

Added:
    cocoon/whiteboard/block-deployer/test/junit/org/apache/cocoon/blockdeployer/logging/
    cocoon/whiteboard/block-deployer/test/junit/org/apache/cocoon/blockdeployer/logging/ConsoleLoggerTest.java

Added: cocoon/whiteboard/block-deployer/test/junit/org/apache/cocoon/blockdeployer/logging/ConsoleLoggerTest.java
URL: http://svn.apache.org/viewcvs/cocoon/whiteboard/block-deployer/test/junit/org/apache/cocoon/blockdeployer/logging/ConsoleLoggerTest.java?view=auto&rev=159020
==============================================================================
--- cocoon/whiteboard/block-deployer/test/junit/org/apache/cocoon/blockdeployer/logging/ConsoleLoggerTest.java
(added)
+++ cocoon/whiteboard/block-deployer/test/junit/org/apache/cocoon/blockdeployer/logging/ConsoleLoggerTest.java
Fri Mar 25 06:14:34 2005
@@ -0,0 +1,75 @@
+package org.apache.cocoon.blockdeployer.logging;
+
+import junit.framework.TestCase;
+
+public class ConsoleLoggerTest extends TestCase {
+
+    public void testConsoleLogger() {
+        ConsoleLogger logger = null;
+        try {
+            logger = new ConsoleLogger("");
+            fail("The loglevel is needed as constructor");
+        } catch(IllegalArgumentException iae) {
+            // correct behaviour
+        }
+        try {
+            logger = new ConsoleLogger(null);
+            fail("The loglevel is needed as constructor");
+        } catch(IllegalArgumentException iae) {
+            // correct behaviour
+        }        
+    }
+
+    public void testIsDebugEnabled() {
+        ConsoleLogger logger = new ConsoleLogger(LoggerFacade.LOG_DEBUG);
+        assertEquals(true, logger.isDebugEnabled());
+        assertEquals(true, logger.isInfoEnabled());
+        assertEquals(true, logger.isWarnEnabled());
+        assertEquals(true, logger.isErrorEnabled());
+        logger.setLoglevel(LoggerFacade.LOG_DEBUG);
+        assertEquals(true, logger.isDebugEnabled());
+        assertEquals(true, logger.isInfoEnabled());
+        assertEquals(true, logger.isWarnEnabled());
+        assertEquals(true, logger.isErrorEnabled());        
+    }
+
+    public void testIsInfoEnabled() {
+        ConsoleLogger logger = new ConsoleLogger(LoggerFacade.LOG_INFO);
+        assertEquals(false, logger.isDebugEnabled());
+        assertEquals(true, logger.isInfoEnabled());
+        assertEquals(true, logger.isWarnEnabled());
+        assertEquals(true, logger.isErrorEnabled());
+        logger.setLoglevel(LoggerFacade.LOG_INFO);
+        assertEquals(false, logger.isDebugEnabled());
+        assertEquals(true, logger.isInfoEnabled());
+        assertEquals(true, logger.isWarnEnabled());
+        assertEquals(true, logger.isErrorEnabled());       
+    }
+
+    public void testIsWarnEnabled() {
+        ConsoleLogger logger = new ConsoleLogger(LoggerFacade.LOG_WARN);
+        assertEquals(false, logger.isDebugEnabled());
+        assertEquals(false, logger.isInfoEnabled());
+        assertEquals(true, logger.isWarnEnabled());
+        assertEquals(true, logger.isErrorEnabled());
+        logger.setLoglevel(LoggerFacade.LOG_WARN);
+        assertEquals(false, logger.isDebugEnabled());
+        assertEquals(false, logger.isInfoEnabled());
+        assertEquals(true, logger.isWarnEnabled());
+        assertEquals(true, logger.isErrorEnabled());        
+    }
+
+    public void testIsErrorEnabled() {
+        ConsoleLogger logger = new ConsoleLogger(LoggerFacade.LOG_ERROR);
+        assertEquals(false, logger.isDebugEnabled());
+        assertEquals(false, logger.isInfoEnabled());
+        assertEquals(false, logger.isWarnEnabled());
+        assertEquals(true, logger.isErrorEnabled());
+        logger.setLoglevel(LoggerFacade.LOG_ERROR);
+        assertEquals(false, logger.isDebugEnabled());
+        assertEquals(false, logger.isInfoEnabled());
+        assertEquals(false, logger.isWarnEnabled());
+        assertEquals(true, logger.isErrorEnabled());          
+    }
+
+}



Mime
View raw message