@Test public void toHtml_ShouldEncodeDataAsJsonAndEscapeHtmlCharacters_WhenDataIsPresent() { final SomeClass data = new SomeClass(); data.child = new SomeClass(); data.child.text = "sub-text"; data.text = "Escaping<test> &amp; \"checked'"; data.number = 42; final ObjectEmbedding cut = new ObjectEmbedding(null, null, data, null); final String html = cut.toHtml(); assertThat(html).isEqualTo("" + "{&quot;number&quot;:42," + "&quot;text&quot;:&quot;Escaping&lt;test&gt; &amp;amp; \\&quot;checked&apos;&quot;," + "&quot;child&quot;:{&quot;number&quot;:0,&quot;text&quot;:&quot;sub-text&quot;,&quot;child&quot;:null}}"); }
@Override public String toHtml() { Object object = getData(); if (object == null) { return ""; } return StringEscapeUtils.escapeXml10(JSONValue.toJSONString(object, JSONStyle.NO_COMPRESS)); }
ObjectEmbedding extends StructuredEmbedding { @Override public String toHtml() { Object object = getData(); if (object == null) { return ""; } return StringEscapeUtils.escapeXml10(JSONValue.toJSONString(object, JSONStyle.NO_COMPRESS)); } }
ObjectEmbedding extends StructuredEmbedding { @Override public String toHtml() { Object object = getData(); if (object == null) { return ""; } return StringEscapeUtils.escapeXml10(JSONValue.toJSONString(object, JSONStyle.NO_COMPRESS)); } ObjectEmbedding(String kind, String name, Object object, EmbeddingPriority priority); }
ObjectEmbedding extends StructuredEmbedding { @Override public String toHtml() { Object object = getData(); if (object == null) { return ""; } return StringEscapeUtils.escapeXml10(JSONValue.toJSONString(object, JSONStyle.NO_COMPRESS)); } ObjectEmbedding(String kind, String name, Object object, EmbeddingPriority priority); @Override String toHtml(); }
ObjectEmbedding extends StructuredEmbedding { @Override public String toHtml() { Object object = getData(); if (object == null) { return ""; } return StringEscapeUtils.escapeXml10(JSONValue.toJSONString(object, JSONStyle.NO_COMPRESS)); } ObjectEmbedding(String kind, String name, Object object, EmbeddingPriority priority); @Override String toHtml();  }