@Test public void toHtml_ShouldEscapeHtmlCharacters_WhenUrlContainsHtmlCharacters() { final String urlWithHtml = "Escaping<test> &amp; \"checked'"; final ImageEmbedding cut = new ImageEmbedding(null, null, urlWithHtml, null); final String html = cut.toHtml(); assertThat(html).isEqualTo("" + "<div style=\"max-width: 100%; max-height: 400px; overflow: auto; box-shadow: 0 0 8px lightgray;\">" + "<img style=\"max-width: 100%;\" src=\"Escaping&lt;test&gt; &amp;amp; &quot;checked&apos;\">" + "</div>"); }
@Override public String toHtml() { Object url = getData(); if (url == null) { return ""; } return "<div style=\"max-width: 100%; max-height: 400px; overflow: auto; box-shadow: 0 0 8px lightgray;\">" + "<img style=\"max-width: 100%;\" src=\"" + StringEscapeUtils.escapeXml10(url.toString()) + "\">" + "</div>"; }
ImageEmbedding extends StructuredEmbedding { @Override public String toHtml() { Object url = getData(); if (url == null) { return ""; } return "<div style=\"max-width: 100%; max-height: 400px; overflow: auto; box-shadow: 0 0 8px lightgray;\">" + "<img style=\"max-width: 100%;\" src=\"" + StringEscapeUtils.escapeXml10(url.toString()) + "\">" + "</div>"; } }
ImageEmbedding extends StructuredEmbedding { @Override public String toHtml() { Object url = getData(); if (url == null) { return ""; } return "<div style=\"max-width: 100%; max-height: 400px; overflow: auto; box-shadow: 0 0 8px lightgray;\">" + "<img style=\"max-width: 100%;\" src=\"" + StringEscapeUtils.escapeXml10(url.toString()) + "\">" + "</div>"; } ImageEmbedding(String kind, String name, String imageUrl, EmbeddingPriority priority); }
ImageEmbedding extends StructuredEmbedding { @Override public String toHtml() { Object url = getData(); if (url == null) { return ""; } return "<div style=\"max-width: 100%; max-height: 400px; overflow: auto; box-shadow: 0 0 8px lightgray;\">" + "<img style=\"max-width: 100%;\" src=\"" + StringEscapeUtils.escapeXml10(url.toString()) + "\">" + "</div>"; } ImageEmbedding(String kind, String name, String imageUrl, EmbeddingPriority priority); @Override String toHtml(); }
ImageEmbedding extends StructuredEmbedding { @Override public String toHtml() { Object url = getData(); if (url == null) { return ""; } return "<div style=\"max-width: 100%; max-height: 400px; overflow: auto; box-shadow: 0 0 8px lightgray;\">" + "<img style=\"max-width: 100%;\" src=\"" + StringEscapeUtils.escapeXml10(url.toString()) + "\">" + "</div>"; } ImageEmbedding(String kind, String name, String imageUrl, EmbeddingPriority priority); @Override String toHtml();  }