@Test public void testPropertiesList() throws Exception { defaults.setProperty("a", "b"); props.setProperty("x", "y"); StringWriter wr = new StringWriter(); props.list(new PrintWriter(wr)); }
@Test @Ignore public void testPropertiesSaveXml() throws Exception { props.setProperty("x", "y"); props.setProperty("a", "b"); ByteArrayOutputStream bos = new ByteArrayOutputStream(); props.storeToXML(bos, "comment"); System.out.println(bos.toString()); }
@Test public void testPropertiesSave() throws Exception { props.setProperty("x", "y"); props.setProperty("a", "b"); StringWriter writer = new StringWriter(); props.store(writer, "no-comment"); // System.out.println(writer.toString()); }
@Test public void testStringPropertyNames() throws Exception { String key1 = "foo"; String key2 = "x"; String key3 = "d"; String val = "o"; defaults.setProperty(key3, val); props.setProperty(key1, val); props.setProperty(key2, val); Set<String> keys = props.stringPropertyNames(); assertTrue(keys.contains(key1)); assertTrue(keys.contains(key2)); assertTrue(keys.contains(key3)); }
@Test public void testPropertyNames() throws Exception { String key1 = "foo"; String key2 = "x"; String key3 = "d"; String val = "o"; defaults.setProperty(key3, val); props.setProperty(key1, val); props.setProperty(key2, val); Enumeration<?> names = props.propertyNames(); Set<Object> keys = new LinkedHashSet<Object>(); keys.add(names.nextElement()); keys.add(names.nextElement()); keys.add(names.nextElement()); assertFalse(names.hasMoreElements()); }