1.1 --- a/test/java/util/Properties/XMLReadAndWriteTest.java Wed Jun 24 14:53:01 2009 +0200
1.2 +++ b/test/java/util/Properties/XMLReadAndWriteTest.java Wed Jun 24 16:38:24 2009 +0200
1.3 @@ -3,6 +3,7 @@
1.4 * and open the template in the editor.
1.5 */
1.6
1.7 +import java.io.ByteArrayInputStream;
1.8 import sun.util.xml.PropertiesXMLUtils;
1.9
1.10 import java.io.ByteArrayOutputStream;
1.11 @@ -22,6 +23,7 @@
1.12 public static void main(String[] args) throws Exception {
1.13 XMLReadAndWriteTest test = new XMLReadAndWriteTest();
1.14 test.testCompareOutput();
1.15 + test.testCompareInput();
1.16 }
1.17
1.18
1.19 @@ -48,4 +50,34 @@
1.20 }
1.21 }
1.22
1.23 + public void testCompareInput() throws IOException {
1.24 + String text = "<?xml version='1.0' encoding='UTF-8' standalone='no'?>" +
1.25 + " <!DOCTYPE properties SYSTEM 'http://java.sun.com/dtd/properties.dtd'>" +
1.26 + "<properties>\n" +
1.27 + "<comment>my commment on beginging\n" +
1.28 + "and on the second line" +
1.29 + "</comment>" +
1.30 + "<entry key=\"ahoj\">simple</entry>\n" +
1.31 + " <entry key=\"kuk\">buk</entry>" +
1.32 + " <entry key='multi'>one\n" +
1.33 + "two\n" +
1.34 + "three\n" +
1.35 + "four</entry>\n</properties>";
1.36 +
1.37 + Properties p1 = new Properties();
1.38 + {
1.39 + ByteArrayInputStream is = new ByteArrayInputStream(text.getBytes("UTF-8"));
1.40 + FULL.load(p1, is);
1.41 + }
1.42 +
1.43 + Properties p2 = new Properties();
1.44 + {
1.45 + ByteArrayInputStream is = new ByteArrayInputStream(text.getBytes("UTF-8"));
1.46 + SIMPLE.load(p2, is);
1.47 + }
1.48 +
1.49 + assert p1.equals(p2) : "P1: " + p1 + "\nP2: " + p2;
1.50 + System.err.println("OK: testCompareInput");
1.51 + }
1.52 +
1.53 }
1.54 \ No newline at end of file