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