Skip to content

Commit

Permalink
new unit test
Browse files Browse the repository at this point in the history
  • Loading branch information
brunovg committed Jan 24, 2025
1 parent ffd5c31 commit dad5b4e
Show file tree
Hide file tree
Showing 7 changed files with 70 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -380,6 +380,55 @@ public void testJsonXml_7_EATT() throws Exception {
);
}

/*****************************************
** Example 8
*****************************************/

@Test
public void testJsonXml_8_EARFF() throws Exception {
compareInputJsonFileWithOutputXmlFile(
"jsontoxmllegacy_Element_Array_Root",
"json-to-xml/example_8.json",
"json-to-xml/example_8_EARFF.xml"
);
}

@Test
public void testJsonXml_8_EARTF() throws Exception {
compareInputJsonFileWithOutputXmlFile(
"jsontoxmllegacy_Element_Array_Root_NamespaceLenient",
"json-to-xml/example_8.json",
"json-to-xml/example_8_EARTF.xml"
);
}

@Test
public void testJsonXml_8_EARFT() throws Exception {
compareInputJsonFileWithOutputXmlFile(
"jsontoxmllegacy_Element_Array_Root_TypeHints",
"json-to-xml/example_8.json",
"json-to-xml/example_8_EARFT.xml"
);
}

@Test
public void testJsonXml_8_EARTT() throws Exception {
compareInputJsonFileWithOutputXmlFile(
"jsontoxmllegacy_Element_Array_Root_NamespaceLenient_TypeHints",
"json-to-xml/example_8.json",
"json-to-xml/example_8_EARTT.xml"
);
}

@Test
public void testJsonXml_8_EATT() throws Exception {
compareInputJsonFileWithOutputXmlFile(
"jsontoxmllegacy_Element_Array_NamespaceLenient_TypeHints",
"json-to-xml/example_8.json",
"json-to-xml/example_8_EATT.xml"
);
}

private void compareInputJsonFileWithOutputXmlFile(String routeName, String inputJsonFile, String outputXmlFile)
throws IOException, InterruptedException {
String defaultJson = IOUtils.toString(classLoader.getResourceAsStream(inputJsonFile), StandardCharsets.UTF_8);
Expand Down
3 changes: 3 additions & 0 deletions jsontoxmllegacy/src/test/resources/json-to-xml/example_8.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"test": null
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<?xml version="1.0" encoding="UTF-8"?>
<root><test json_null="true"/></root>
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<root>
<test class="object" null="true"/>
</root>
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<root>
<test json_null="true"/>
</root>
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<root>
<test class="object" null="true"/>
</root>
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<o>
<test class="object" null="true"/>
</o>

0 comments on commit dad5b4e

Please sign in to comment.