Skip to content

Commit c233ae7

Browse files
author
John J. Aylward
committed
comment out second unreliable test
1 parent 95da424 commit c233ae7

File tree

1 file changed

+22
-21
lines changed

1 file changed

+22
-21
lines changed

src/test/java/org/json/junit/JSONMLTest.java

Lines changed: 22 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -762,29 +762,30 @@ public void testToJSONObject_reversibility() {
762762
assertEquals("original JSON does not equal the new JSON",originalJson, newJson);
763763
}
764764

765-
/**
766-
* Test texts taken from jsonml.org. Currently our implementation FAILS this conversion but shouldn't.
767-
* Technically JsonML should be able to transform any valid xhtml document, but ours only supports
768-
* standard XML entities, not HTML entities.
769-
*/
770-
@Test
771-
public void testAttributeConversionReversabilityHTML() {
772-
final String originalXml = "<table class=\"MyTable\" style=\"background-color:yellow\"><tr><td class=\"MyTD\" style=\"border:1px solid black\">#5D28D1</td><td class=\"MyTD\" style=\"background-color:red\">Example text here</td></tr><tr><td class=\"MyTD\" style=\"border:1px solid black\">#AF44EF</td><td class=\"MyTD\" style=\"background-color:green\">127310656</td></tr><tr><td class=\"MyTD\" style=\"border:1px solid black\">#AAD034</td><td class=\"MyTD\" style=\"background-color:blue\">&nbsp;<span style=\"background-color:maroon\">&copy;</span>&nbsp;</td></tr></table>";
773-
final String expectedJsonString = "[\"table\",{\"class\" : \"MyTable\",\"style\" : \"background-color:yellow\"},[\"tr\",[\"td\",{\"class\" : \"MyTD\",\"style\" : \"border:1px solid black\"},\"#550758\"],[\"td\",{\"class\" : \"MyTD\",\"style\" : \"background-color:red\"},\"Example text here\"]],[\"tr\",[\"td\",{\"class\" : \"MyTD\",\"style\" : \"border:1px solid black\"},\"#993101\"],[\"td\",{\"class\" : \"MyTD\",\"style\" : \"background-color:green\"},\"127624015\"]],[\"tr\",[\"td\",{\"class\" : \"MyTD\",\"style\" : \"border:1px solid black\"},\"#E33D87\"],[\"td\",{\"class\" : \"MyTD\",\"style\" : \"background-color:blue\"},\"\u00A0\",[\"span\",{ \"style\" : \"background-color:maroon\" },\"\u00A9\"],\"\u00A0\"]]]";
774-
final JSONArray json = JSONML.toJSONArray(originalXml,true);
775-
final String actualJsonString = json.toString();
776-
777-
final String reverseXml = JSONML.toString(json);
778-
assertNotEquals(originalXml, reverseXml);
779-
780-
assertNotEquals(expectedJsonString, actualJsonString);
781-
}
782-
783-
// this test does not pass for the following reasons:
765+
// these tests do not pass for the following reasons:
784766
// 1. Our XML parser does not handle generic HTML entities, only valid XML entities. Hence &nbsp;
785-
// or other HTML specific entities would fail on reversability
767+
// or other HTML specific entities would fail on reversability
786768
// 2. Our JSON implementation for storing the XML attributes uses the standard unordered map.
787-
// This means that <tag attr1="v1" attr2="v2" /> can not be reversed reliably.
769+
// This means that <tag attr1="v1" attr2="v2" /> can not be reversed reliably.
770+
//
771+
// /**
772+
// * Test texts taken from jsonml.org. Currently our implementation FAILS this conversion but shouldn't.
773+
// * Technically JsonML should be able to transform any valid xhtml document, but ours only supports
774+
// * standard XML entities, not HTML entities.
775+
// */
776+
// @Test
777+
// public void testAttributeConversionReversabilityHTML() {
778+
// final String originalXml = "<table class=\"MyTable\" style=\"background-color:yellow\"><tr><td class=\"MyTD\" style=\"border:1px solid black\">#5D28D1</td><td class=\"MyTD\" style=\"background-color:red\">Example text here</td></tr><tr><td class=\"MyTD\" style=\"border:1px solid black\">#AF44EF</td><td class=\"MyTD\" style=\"background-color:green\">127310656</td></tr><tr><td class=\"MyTD\" style=\"border:1px solid black\">#AAD034</td><td class=\"MyTD\" style=\"background-color:blue\">&nbsp;<span style=\"background-color:maroon\">&copy;</span>&nbsp;</td></tr></table>";
779+
// final String expectedJsonString = "[\"table\",{\"class\" : \"MyTable\",\"style\" : \"background-color:yellow\"},[\"tr\",[\"td\",{\"class\" : \"MyTD\",\"style\" : \"border:1px solid black\"},\"#550758\"],[\"td\",{\"class\" : \"MyTD\",\"style\" : \"background-color:red\"},\"Example text here\"]],[\"tr\",[\"td\",{\"class\" : \"MyTD\",\"style\" : \"border:1px solid black\"},\"#993101\"],[\"td\",{\"class\" : \"MyTD\",\"style\" : \"background-color:green\"},\"127624015\"]],[\"tr\",[\"td\",{\"class\" : \"MyTD\",\"style\" : \"border:1px solid black\"},\"#E33D87\"],[\"td\",{\"class\" : \"MyTD\",\"style\" : \"background-color:blue\"},\"\u00A0\",[\"span\",{ \"style\" : \"background-color:maroon\" },\"\u00A9\"],\"\u00A0\"]]]";
780+
// final JSONArray json = JSONML.toJSONArray(originalXml,true);
781+
// final String actualJsonString = json.toString();
782+
//
783+
// final String reverseXml = JSONML.toString(json);
784+
// assertNotEquals(originalXml, reverseXml);
785+
//
786+
// assertNotEquals(expectedJsonString, actualJsonString);
787+
// }
788+
//
788789
// /**
789790
// * Test texts taken from jsonml.org but modified to have XML entities only.
790791
// */

0 commit comments

Comments
 (0)