Skip to content

Commit fcd4b11

Browse files
committed
Add more unit tests for the fromXml() method.
1 parent f56585e commit fcd4b11

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

string-plugin/src/test/java/com/github/underscore/string/StringTest.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1430,6 +1430,16 @@ public void fromXml2() {
14301430
$.toJson((Map<String, Object>) $.fromXml(string)));
14311431
}
14321432

1433+
@SuppressWarnings("unchecked")
1434+
@Test
1435+
public void fetchGetXml() {
1436+
String xml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?><report><time/><coords><x>3916.234</x><y>169.914</y><z>6.33</z>"
1437+
+ "</coords><code>NMR</code><message>Another day of everyday normal regular weather, business as usual, unless "
1438+
+ "it’s going to be like the time of the Great Paprika Mayonnaise Incident of 2014, that was some pretty nasty "
1439+
+ "stuff.</message><varX-Rating>8</varX-Rating></report>";
1440+
assertEquals("NMR", (String) ((Map<String, Object>) $.fromXml(xml)).get("code"));
1441+
}
1442+
14331443
@Test(expected = IllegalArgumentException.class)
14341444
public void testDecodeParseXmlErr13() {
14351445
$.fromXml("[\"abc\u0010\"]");

0 commit comments

Comments
 (0)