Author: adietish
Date: 2011-09-20 07:31:16 -0400 (Tue, 20 Sep 2011)
New Revision: 34878
Modified:
trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/test/internal/core/JsonSanitizerTest.java
Log:
[JBIDE-9748] added tests for JsonSanitizer
Modified:
trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/test/internal/core/JsonSanitizerTest.java
===================================================================
---
trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/test/internal/core/JsonSanitizerTest.java 2011-09-20
11:27:35 UTC (rev 34877)
+++
trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/test/internal/core/JsonSanitizerTest.java 2011-09-20
11:31:16 UTC (rev 34878)
@@ -49,6 +49,20 @@
@Test
public void doesNotRemoveEscapedQuoteInStringValue() throws OpenshiftException {
String quotedJsonObject =
+ "\"{"
+ + "\\\"property\\\":"
+ + "\\\"stringWithA\\\\\"Quote\""
+ + "}\"";
+
+ String sanitizedJson = JsonSanitizer.sanitize(quotedJsonObject);
+ assertEquals("{\"property\":\"stringWithA\\\"Quote\"}",
sanitizedJson);
+ ModelNode node = ModelNode.fromJSONString(sanitizedJson);
+ assertEquals("stringWithA\"Quote",
node.get("property").asString());
+ }
+
+ @Test
+ public void doesNotRemoveEscapedQuoteInStringValueWithinValidJsonObject() throws
OpenshiftException {
+ String quotedJsonObject =
"{"
+ "\"property\":"
+ "\"stringWithA\\\"Quote\""
@@ -59,5 +73,5 @@
ModelNode node = ModelNode.fromJSONString(sanitizedJson);
assertEquals("stringWithA\"Quote",
node.get("property").asString());
}
-
+
}
Show replies by date