package CustomDNS.Tests;
import CustomDNS.Tests.CustomDNSTestCase;
import CustomDNS.SimpleConfiguration;
public class TestSimpleConfiguration extends CustomDNSTestCase {
SimpleConfiguration myConfig;
public TestSimpleConfiguration (String name) {
super(name);
}
protected void setUp () throws Exception {
myConfig = new SimpleConfiguration(fullPath("customdns.prop"));
}
public void testGetProperty () {
assertEquals(myConfig.getProperty("foo"), "bar");
assertEquals(myConfig.getProperty("foo.x.y"), "baz");
}
public void testGetMissingProperty () {
assertEquals(myConfig.getProperty("missing"), null);
}
public void testGetMissingPropertyDefault () {
assertEquals(myConfig.getProperty("missing", "default"), "default");
}
public void testMissingFile () throws Exception {
try {
new SimpleConfiguration(fullPath("thisFileShouldNotExist"));
fail("Expected FileNotFoundException");
} catch (java.io.FileNotFoundException e) { }
}
}
|