Skip to content

Instantly share code, notes, and snippets.

@fbiville
Created May 20, 2012 10:14
Show Gist options
  • Select an option

  • Save fbiville/2757562 to your computer and use it in GitHub Desktop.

Select an option

Save fbiville/2757562 to your computer and use it in GitHub Desktop.
Tests of Gist https://t.co/hD8iMBLM
@Test
public void when_plain_text_then_equal_text_returned() {
assertThat(markupKiller.stripTags("10 < 9")).isEqualTo("10 < 9");
}
@Test
public void when_unbalanced_html_then_markup_removed() {
assertThat(markupKiller.stripTags("<b>10 < 9")).isEqualTo("10 < 9");
assertThat(markupKiller.stripTags("<b id='whatever'>10 < 9<img />")).isEqualTo("10 < 9");
}
@Test
public void when_balanced_html_then_markup_removed() {
assertThat(markupKiller.stripTags("<b>10 < 9</b>")).isEqualTo("10 < 9");
assertThat(markupKiller.stripTags("<b id='whatever'>10 < 9")).isEqualTo("10 < 9");
}
@Test
@Ignore("not supported and might be not needed")
public void when_balanced_html_entities_then_markup_removed() {
assertThat(markupKiller.stripTags("&lt;b&gt;10 &lt; 9</b>")).isEqualTo("10 &lt; 9");
assertThat(markupKiller.stripTags("&lt;b id='whatever'&gt;10 &lt; 9")).isEqualTo("10 &lt; 9");
}
@fbiville

Copy link
Copy Markdown
Author

I is the gist owner, I is your dictator.

@pyricau

pyricau commented May 20, 2012

Copy link
Copy Markdown

All your base are belong to GitHub

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment