1 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 ; 17 import java.util.Map ; 18 19 23 public class SimpleFormatterTest extends TestCase { 24 25 public SimpleFormatterTest(java.lang.String testName) { 26 super(testName); 27 } 28 29 public static void main(java.lang.String [] 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 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 params = new HashMap (); 49 params.put("date","dd.MM.yyyy"); 50 sf.setParameter(params); 51 String test = sf.formatMessage(lr); 52 assertNotNull(test); 53 System.out.println(test); 54 } 55 56 57 } 58 | Popular Tags |