Esempio n. 1
0
  public void testStripStartExists() throws Exception {

    Properties p1 = PropertiesUtil.getPropertiesStartingWith("testprop", props);
    Properties p2 = PropertiesUtil.stripStart("testprop", p1);

    assertEquals(2, p2.size());
    assertEquals("myname", p2.get("name"));
    assertEquals("myaddress", p2.get("address"));
  }
Esempio n. 2
0
 public void testStripStartNullProperties() throws Exception {
   try {
     PropertiesUtil.stripStart("blahblah", null);
     fail("Expected: NullPointerException");
   } catch (NullPointerException e) {
   }
 }
Esempio n. 3
0
 public void testStartingWithNullProperties() throws Exception {
   try {
     PropertiesUtil.getPropertiesStartingWith("blahblah", null);
     fail("Expected: NullPointerException");
   } catch (NullPointerException e) {
   }
 }
Esempio n. 4
0
  public void testStartingWithExists() throws Exception {

    Properties p = PropertiesUtil.getPropertiesStartingWith("testprop", props);

    assertEquals(2, p.size());
    assertEquals("myname", p.get("testprop.name"));
    assertEquals("myaddress", p.get("testprop.address"));
  }
Esempio n. 5
0
 public void testLoadInvalid() throws Exception {
   try {
     Properties p = PropertiesUtil.loadProperties("invalidTest.properties");
     fail("Expected: IllegalArgumentException");
   } catch (IllegalArgumentException e) {
     assertEquals(
         "Cannot override non-overrideable property flibble = flobble with new value flooble",
         e.getMessage());
   }
 }
Esempio n. 6
0
  public void testStripStartNotExists() throws Exception {

    Properties p = PropertiesUtil.stripStart("nothing", props);

    assertEquals(0, p.size());
  }
Esempio n. 7
0
  public void testStartingWithNotExists() throws Exception {

    Properties p = PropertiesUtil.getPropertiesStartingWith("nothing", props);

    assertEquals(0, p.size());
  }