Skip to content

Commit ea37816

Browse files
committed
Minor test imporvement
1 parent d994ff5 commit ea37816

File tree

1 file changed

+14
-11
lines changed

1 file changed

+14
-11
lines changed

properties/src/test/java/com/fasterxml/jackson/dataformat/javaprop/MapParsingTest.java

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ public void testMapWithBranchNoEscaping() throws Exception
3434
assertEquals("first", w.map.get(""));
3535
assertEquals("second", w.map.get("b"));
3636
assertEquals("third", w.map.get("xyz"));
37-
assertEquals("fourth", ((Map) w.map.get("ab\\")).get("c"));
37+
assertEquals("fourth", ((Map<?,?>) w.map.get("ab\\")).get("c"));
3838
}
3939

4040
public void testMapWithBranchBackslashEscape() throws Exception
@@ -55,7 +55,9 @@ public void testMapWithBranchBackslashEscape() throws Exception
5555
+"map.xy\\\\\\\\.d.ij=eleventh\n" // xy\\.d.ij => xy\->d->ij
5656
+"map.xy\\\\\\\\\\\\.d.ij=twelfth\n" // xy\\\.d => xy\.d->ij
5757
;
58-
MapWrapper w = mapper.reader(new JavaPropsSchema().withPathSeparatorEscapeChar('\\')).readValue(INPUT, MapWrapper.class);
58+
MapWrapper w = mapper.readerFor(MapWrapper.class)
59+
.with(new JavaPropsSchema().withPathSeparatorEscapeChar('\\'))
60+
.readValue(INPUT);
5961
assertNotNull(w.map);
6062
System.out.println(w.map.toString());
6163
assertEquals(12, w.map.size());
@@ -66,11 +68,11 @@ public void testMapWithBranchBackslashEscape() throws Exception
6668
assertEquals("fifth", w.map.get("ab\\cd.ef.gh\\\\ij"));
6769
assertEquals("sixth", w.map.get("."));
6870
assertEquals("seventh", w.map.get("ab.d"));
69-
assertEquals("eigth", ((Map) w.map.get("ef\\")).get("d"));
71+
assertEquals("eigth", ((Map<?,?>) w.map.get("ef\\")).get("d"));
7072
assertEquals("ninth", w.map.get("ab\\.d"));
71-
assertEquals("tenth", ((Map) w.map.get("xy.d")).get("ij"));
72-
assertEquals("eleventh", ((Map) ((Map) w.map.get("xy\\")).get("d")).get("ij"));
73-
assertEquals("twelfth", ((Map) w.map.get("xy\\.d")).get("ij"));
73+
assertEquals("tenth", ((Map<?,?>) w.map.get("xy.d")).get("ij"));
74+
assertEquals("eleventh", ((Map<?,?>) ((Map<?,?>) w.map.get("xy\\")).get("d")).get("ij"));
75+
assertEquals("twelfth", ((Map<?,?>) w.map.get("xy\\.d")).get("ij"));
7476
}
7577

7678

@@ -92,7 +94,8 @@ public void testMapWithBranchHashEscape() throws Exception
9294
+"map.xy##.d.ij=eleventh\n" // xy##.d.ij => xy#->d->ij
9395
+"map.xy###.d.ij=twelfth\n" // xy###.d => xy#.d->ij
9496
;
95-
MapWrapper w = mapper.reader(new JavaPropsSchema().withPathSeparatorEscapeChar('#')).readValue(INPUT, MapWrapper.class);
97+
MapWrapper w = mapper.readerFor(MapWrapper.class)
98+
.with(new JavaPropsSchema().withPathSeparatorEscapeChar('#')).readValue(INPUT);
9699
assertNotNull(w.map);
97100
System.out.println(w.map.toString());
98101
assertEquals(12, w.map.size());
@@ -103,11 +106,11 @@ public void testMapWithBranchHashEscape() throws Exception
103106
assertEquals("fifth", w.map.get("ab#cd.ef.gh##ij"));
104107
assertEquals("sixth", w.map.get("."));
105108
assertEquals("seventh", w.map.get("ab.d"));
106-
assertEquals("eigth", ((Map) w.map.get("ef#")).get("d"));
109+
assertEquals("eigth", ((Map<?,?>) w.map.get("ef#")).get("d"));
107110
assertEquals("ninth", w.map.get("ab#.d"));
108-
assertEquals("tenth", ((Map) w.map.get("xy.d")).get("ij"));
109-
assertEquals("eleventh", ((Map) ((Map) w.map.get("xy#")).get("d")).get("ij"));
110-
assertEquals("twelfth", ((Map) w.map.get("xy#.d")).get("ij"));
111+
assertEquals("tenth", ((Map<?,?>) w.map.get("xy.d")).get("ij"));
112+
assertEquals("eleventh", ((Map<?,?>) ((Map<?,?>) w.map.get("xy#")).get("d")).get("ij"));
113+
assertEquals("twelfth", ((Map<?,?>) w.map.get("xy#.d")).get("ij"));
111114
}
112115

113116
}

0 commit comments

Comments
 (0)