KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jzonic > jlo > LogManagerTest


1 /*
2  * LogManagerTest.java
3  * JUnit based test
4  *
5  * Created on 4. Mai 2003, 20:59
6  */

7
8 package org.jzonic.jlo;
9
10 import junit.framework.Test;
11 import junit.framework.TestCase;
12 import junit.framework.TestSuite;
13
14 /**
15  *
16  * @author Administrator
17  */

18 public class LogManagerTest extends TestCase {
19     
20     public LogManagerTest(java.lang.String JavaDoc testName) {
21         super(testName);
22     }
23     
24     public static void main(java.lang.String JavaDoc[] args) {
25         junit.textui.TestRunner.run(suite());
26     }
27     
28     public static Test suite() {
29         TestSuite suite = new TestSuite(LogManagerTest.class);
30         
31         return suite;
32     }
33     
34     public void testGetInstance() {
35         LogManager lm = LogManager.getInstance();
36         assertNotNull(lm);
37     }
38     
39     public void testGetLogger() {
40         Logger logger = LogManager.getLogger("org.jzonic.jlo");
41         assertNotNull(logger);
42     }
43         
44     public void testGetNonExistingLogger() {
45         Logger logger = LogManager.getLogger("org.jzonic.jlo.test");
46         String JavaDoc name = logger.getLoggerName();
47         assertEquals("org.jzonic.jlo",name);
48     }
49     
50     public void testGetNonExistingLogger2() {
51         Logger logger = LogManager.getLogger("org");
52         String JavaDoc name = logger.getLoggerName();
53         assertEquals("Default",name);
54     }
55     
56     public void testGetDifferentLogger() {
57         Logger logger = LogManager.getLogger("de.xcom","test");
58         String JavaDoc name = logger.getLoggerName();
59         assertEquals("de.xcom",name);
60     }
61     
62     public void testGetNEDifferentLogger() {
63         Logger logger = LogManager.getLogger("de.xcom.test.hello","test");
64         String JavaDoc name = logger.getLoggerName();
65         assertEquals("de.xcom.test",name);
66     }
67     
68     public void testGetChannel() {
69         Channel channel = LogManager.getChannel("debug");
70         assertTrue(channel.isOn());
71     }
72     
73     public void testGetDifferentChannel() {
74         Channel channel = LogManager.getChannel("timing","test");
75         String JavaDoc name = channel.getChannelName();
76         assertTrue(channel.isOn());
77         assertEquals("timing",name);
78     }
79     
80     public void testGetNEConfiguration() {
81         Logger logger = LogManager.getLogger("de.xcom","NE");
82         String JavaDoc name = logger.getLoggerName();
83         assertEquals("Default",name);
84     }
85 }
86
Popular Tags