TestSimpleConfiguration.java :  » Net » customdns » CustomDNS » Tests » Java Open Source

Java Open Source » Net » customdns 
customdns » CustomDNS » Tests » TestSimpleConfiguration.java
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) { }
    }
}

java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.