01: package junitx.ddtunit.util;
02:
03: import java.text.DateFormat;
04:
05: import junit.framework.TestCase;
06:
07: import org.apache.log4j.BasicConfigurator;
08:
09: public class DDTConfigurationTest extends TestCase {
10:
11: private DDTConfiguration config;
12:
13: @Override
14: protected void setUp() throws Exception {
15: this .config = DDTConfiguration.getInstance();
16: BasicConfigurator.configure();
17: }
18:
19: public void testLoadString() throws Exception {
20: config.load("/ddtunitConfig.properties");
21: assertFalse("Expected deactivated Monitor", config
22: .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: "/my/ddtunit/log4j.properties", config
31: .getLog4jConfigResource());
32: assertEquals("Wrong active Locale",
33: "Englisch (Vereinigte Staaten von Amerika)", config
34: .getActiveLocale().getDisplayName());
35: assertEquals("Wrong number of date definitions", 4, config
36: .getDateMap().size());
37: DateFormat formater = config.getDateMap().get("mydefault");
38: assertEquals("Wrong date format",
39: "Mon Jun 25 00:00:00 CEST 2007", formater.parse(
40: "Mon Jun 25 00:00:00 CEST 2007").toString());
41: }
42: }
|