KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jzonic > jlo > formatter > SimpleFormatterTest


1 /*
2  * SimpleFormatterTest.java
3  * JUnit based test
4  *
5  * Created on 21. Januar 2003, 23:06
6  */

7
8 package org.jzonic.jlo.formatter;
9
10 import junit.framework.Test;
11 import junit.framework.TestCase;
12 import junit.framework.TestSuite;
13 import org.jzonic.jlo.LogRecord;
14 import org.jzonic.jlo.Target;
15
16 import java.util.HashMap JavaDoc;
17 import java.util.Map JavaDoc;
18
19 /**
20  *
21  * @author Administrator
22  */

23 public class SimpleFormatterTest extends TestCase {
24     
25     public SimpleFormatterTest(java.lang.String JavaDoc testName) {
26         super(testName);
27     }
28     
29     public static void main(java.lang.String JavaDoc[] args) {
30         junit.textui.TestRunner.run(suite());
31     }
32     
33     public static Test suite() {
34         TestSuite suite = new TestSuite(SimpleFormatterTest.class);
35         return suite;
36     }
37     
38     public void testFormat() {
39         LogRecord lr = new LogRecord("Test",Target.trace);
40         SimpleFormatter sf = new SimpleFormatter("Test");
41         String JavaDoc test = sf.formatMessage(lr);
42         assertNotNull(test);
43     }
44
45     public void testFormat2() {
46         LogRecord lr = new LogRecord("Test",Target.trace);
47         SimpleFormatter sf = new SimpleFormatter("Test");
48         Map JavaDoc params = new HashMap JavaDoc();
49         params.put("date","dd.MM.yyyy");
50         sf.setParameter(params);
51         String JavaDoc test = sf.formatMessage(lr);
52         assertNotNull(test);
53         System.out.println(test);
54     }
55
56
57 }
58
Popular Tags