1 16 17 package org.apache.commons.logging.simple; 18 19 import java.util.Date ; 20 import java.text.SimpleDateFormat ; 21 import java.text.DateFormat ; 22 23 import junit.framework.Test; 24 import junit.framework.TestSuite; 25 26 27 30 public class DateTimeCustomConfigTestCase extends CustomConfigTestCase { 31 32 34 37 public static Test suite() { 38 return (new TestSuite(DateTimeCustomConfigTestCase.class)); 39 } 40 41 42 47 public DateTimeCustomConfigTestCase(String name) { 48 super(name); 49 } 50 51 53 54 protected void checkDecoratedDateTime() { 55 assertEquals("Expected date format to be set", "dd.mm.yyyy", 56 ((DecoratedSimpleLog) log).getDateTimeFormat()); 57 58 Date now = new Date (); 60 DateFormat formatter = ((DecoratedSimpleLog) log).getDateTimeFormatter(); 61 SimpleDateFormat sampleFormatter = new SimpleDateFormat ("dd.mm.yyyy"); 62 assertEquals("Date should be formatters to pattern dd.mm.yyyy", sampleFormatter.format(now), formatter.format(now)); 63 } 64 65 66 protected void checkShowDateTime() { 67 assertTrue(((DecoratedSimpleLog) log).getShowDateTime()); 68 } 69 70 } | Popular Tags |