1 package junitx.ddtunit.util;
2
3 import java.text.DateFormat;
4
5 import junit.framework.TestCase;
6
7 import org.slf4j.Logger;
8 import org.slf4j.LoggerFactory;
9
10 public class DDTConfigurationTest extends TestCase {
11
12 private DDTConfiguration config;
13
14 @Override
15 protected void setUp() throws Exception {
16 this.config = DDTConfiguration.getInstance();
17
18 }
19
20 public void testLoadString() throws Exception {
21 config.load("/ddtunitConfig.properties");
22 assertFalse("Expected deactivated Monitor", config.isActiveRunMonitor());
23 assertFalse("Expected deactivated xml validation", config
24 .isActiveXmlValidation());
25 assertFalse("Expected deactivated assert support", config
26 .isActiveAsserts());
27 assertTrue("Expected activated parser validation", config
28 .isActiveParserValidation());
29 assertEquals("Wrong log4j resource path",
30 "/junitx.ddtunit.log4j.properties", config.getLog4jConfigResource());
31 assertEquals("Wrong active Locale",
32 "English (United States)", config
33 .getActiveLocale().getDisplayName());
34 assertEquals("Wrong number of date definitions", 4, config.getDateMap()
35 .size());
36 DateFormat formater = config.getDateMap().get("example");
37 assertEquals("Wrong date format", "Mon Jun 25 00:00:00 CEST 2007",
38 formater.parse("Mon Jun 25 00:00:00 CEST 2007").toString());
39 }
40 }