Skip to content

Commit c291dc1

Browse files
committed
Add toXmlFromJson unit test.
1 parent 683945a commit c291dc1

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

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

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1314,6 +1314,20 @@ public void toJsonFromXml() {
13141314
$.toJson((Map<String, Object>) $.fromXml(xml)));
13151315
}
13161316

1317+
@SuppressWarnings("unchecked")
1318+
@Test
1319+
public void toXmlFromJson() {
1320+
final String json = "{\n"
1321+
+ " \"root\": {\n"
1322+
+ " \"FirstItem\": \"1\",\n"
1323+
+ " \"SecondItem\": \"2\"\n"
1324+
+ " }\n"
1325+
+ "}";
1326+
assertEquals("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<root>\n"
1327+
+ " <FirstItem>1</FirstItem>\n <SecondItem>2</SecondItem>\n</root>",
1328+
$.toXml((Map<String, Object>) $.fromJson(json)));
1329+
}
1330+
13171331
@SuppressWarnings("unchecked")
13181332
@Test
13191333
public void toXml() {

0 commit comments

Comments
 (0)