We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 86f4a85 commit 5e5162fCopy full SHA for 5e5162f
4 files changed
src/test/java/org/codejive/properties/TestProperties.java
@@ -671,6 +671,26 @@ void testCursor() throws IOException, URISyntaxException {
671
assertThat(c.prevCount(t -> true)).isEqualTo(p.last().position() + 1);
672
}
673
674
+ @Test
675
+ void testMissingDelim() throws IOException, URISyntaxException {
676
+ Properties p = Properties.loadProperties(getResource("/test-missingdelim.properties"));
677
+ assertThat(p).containsOnlyKeys("A-string-without-delimiter");
678
+ assertThat(p).containsEntry("A-string-without-delimiter", "");
679
+ StringWriter sw = new StringWriter();
680
+ p.store(sw);
681
+ assertThat(sw.toString()).isEqualTo(readAll(getResource("/test-missingdelim.properties")));
682
+ }
683
+
684
685
+ void testMultiDelim() throws IOException, URISyntaxException {
686
+ Properties p = Properties.loadProperties(getResource("/test-multidelim.properties"));
687
+ assertThat(p).containsOnlyKeys("key");
688
+ assertThat(p).containsEntry("key", "==value");
689
690
691
+ assertThat(sw.toString()).isEqualTo(readAll(getResource("/test-multidelim.properties")));
692
693
694
private Path getResource(String name) throws URISyntaxException {
695
return Paths.get(getClass().getResource(name).toURI());
696
src/test/java/org/codejive/properties/TestPropertiesParser.java
@@ -30,6 +30,8 @@ public class TestPropertiesParser {
30
+ " two \\\r\n"
31
+ "\tthree\n"
32
+ "key.4 = \\u1234\r\n"
33
+ + "line-with-missing-delim \n"
34
+ + "multidelim===value\n"
35
+ " # final comment";
36
37
@Test
@@ -81,6 +83,14 @@ void testTokens() throws IOException {
81
83
new Token(Type.SEPARATOR, " = "),
82
84
new Token(Type.VALUE, "\\u1234", "\u1234"),
85
new Token(Type.WHITESPACE, "\r\n"),
86
+ new Token(Type.KEY, "line-with-missing-delim"),
87
+ new Token(Type.SEPARATOR, " "),
88
+ new Token(Type.VALUE, ""),
89
+ new Token(Type.WHITESPACE, "\n"),
90
+ new Token(Type.KEY, "multidelim"),
91
+ new Token(Type.SEPARATOR, "="),
92
+ new Token(Type.VALUE, "==value"),
93
94
new Token(Type.WHITESPACE, " "),
95
new Token(Type.COMMENT, "# final comment"));
96
src/test/resources/test-missingdelim.properties
@@ -0,0 +1 @@
1
+A-string-without-delimiter
src/test/resources/test-multidelim.properties
+key===value
0 commit comments