<commit_before>package net.devrieze.chatterbox.server;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.fail;

import org.junit.Test;


public class UtilTest {

  @Test
  public void testEncodeHtml() {
    assertEquals("hello&quot;&amp;blue;&amp;quot&amp;quot;", Util.encodeHtml("hello\"&blue;&quot&quot;"));
  }

  @Test
  public void testSanitizeHtmlCharSequence1() {
    assertEquals("hello&quot;&amp;blue;&amp;quot&quot;", Util.sanitizeHtml("hello\"&blue;&quot&quot;"));
  }

  @Test
  public void testSanitizeHtmlCharSequence2() {
    assertEquals("<b>hello</b>", Util.sanitizeHtml("<b>hello</b>"));
  }

  @Test
  public void testSanitizeHtmlCharSequence3() {
    assertEquals("<b><i>hello</i></b>", Util.sanitizeHtml("<b><i>hello</i></b>"));
  }

  @Test
  public void testSanitizeHtmlCharSequence4() {
    assertEquals("<b>hello</b>", Util.sanitizeHtml("<b some garba83475ge*&)>hello</b>"));
  }

  @Test
  public void testSanitizeHtmlCharSequence5() {
    assertEquals("<b>&lt;/a&gt;&lt;a href=&quot;blabla&quot;hello</b>", Util.sanitizeHtml("<b></a><a href=\"blabla\"hello</b>"));
  }

  @Test
  public void testSanitizeHtmlCharSequence6() {
    assertEquals("<b>&lt;/a&gt;&lt;a href=&quot;blabla&quot;<i>hello&lt;/b&gt;</i></b>", Util.sanitizeHtml("<b></a><a href=\"blabla\"<i>hello</b>"));
  }

  @Test
  public void testSanitizeHtmlCharSequence7() {
    assertEquals("<b>&lt;/a&gt;&lt;a href=&quot;blabla&quot;<i>hello&lt;/b&gt;</i></b>", Util.sanitizeHtml("<b></a><a href=\"blabla\"<i>hello</b></i>"));
  }

  @Test
  public void testSanitizeHtmlCharSequence8() {
    assertEquals("<b>&lt;/a&gt;&lt;a href=&quot;blabla&quot;<i>hello</i></b>", Util.sanitizeHtml("<b></a><a href=\"blabla\"<i>hello</i></b>"));
  }

  @Test
  public void testSanitizeHtmlCharSequence9() {
    assertEquals("<b>&lt;a href=&quot;blabla&quot;&gt;<i>hello</i></b>", Util.sanitizeHtml("<b onload='doSomeNasty()'><a href=\"blabla\"><i>hello</i></b>"));
  }

  @Test
  public void testSanitizeHtmlCharSequence10() {
    assertEquals("<b>&lt;a href=&quot;blabla&quot;&gt;<i>hello<Br /></I></B>", Util.sanitizeHtml("<b onload='doSomeNasty()'><a href=\"blabla\"><i>hello<br/></i></b>"));
  }

}
<commit_msg>Test that null values work. Also have a correct expectation for sanitation test 10<commit_after>package net.devrieze.chatterbox.server;

import static org.junit.Assert.assertEquals;

import org.junit.Test;


public class UtilTest {

  @Test
  public void testEncodeHtml() {
    assertEquals("hello&quot;&amp;blue;&amp;quot&amp;quot;", Util.encodeHtml("hello\"&blue;&quot&quot;"));
  }

  @Test
  public void testEncodeHtmlNull() {
    assertEquals(null, Util.encodeHtml(null));
  }

  @Test
  public void testSanitizeHtmlCharSequence1() {
    assertEquals("hello&quot;&amp;blue;&amp;quot&quot;", Util.sanitizeHtml("hello\"&blue;&quot&quot;"));
  }

  @Test
  public void testSanitizeHtmlCharSequence2() {
    assertEquals("<b>hello</b>", Util.sanitizeHtml("<b>hello</b>"));
  }

  @Test
  public void testSanitizeHtmlCharSequence3() {
    assertEquals("<b><i>hello</i></b>", Util.sanitizeHtml("<b><i>hello</i></b>"));
  }

  @Test
  public void testSanitizeHtmlCharSequence4() {
    assertEquals("<b>hello</b>", Util.sanitizeHtml("<b some garba83475ge*&)>hello</b>"));
  }

  @Test
  public void testSanitizeHtmlCharSequence5() {
    assertEquals("<b>&lt;/a&gt;&lt;a href=&quot;blabla&quot;hello</b>", Util.sanitizeHtml("<b></a><a href=\"blabla\"hello</b>"));
  }

  @Test
  public void testSanitizeHtmlCharSequence6() {
    assertEquals("<b>&lt;/a&gt;&lt;a href=&quot;blabla&quot;<i>hello&lt;/b&gt;</i></b>", Util.sanitizeHtml("<b></a><a href=\"blabla\"<i>hello</b>"));
  }

  @Test
  public void testSanitizeHtmlCharSequence7() {
    assertEquals("<b>&lt;/a&gt;&lt;a href=&quot;blabla&quot;<i>hello&lt;/b&gt;</i></b>", Util.sanitizeHtml("<b></a><a href=\"blabla\"<i>hello</b></i>"));
  }

  @Test
  public void testSanitizeHtmlCharSequence8() {
    assertEquals("<b>&lt;/a&gt;&lt;a href=&quot;blabla&quot;<i>hello</i></b>", Util.sanitizeHtml("<b></a><a href=\"blabla\"<i>hello</i></b>"));
  }

  @Test
  public void testSanitizeHtmlCharSequence9() {
    assertEquals("<b>&lt;a href=&quot;blabla&quot;&gt;<i>hello</i></b>", Util.sanitizeHtml("<b onload='doSomeNasty()'><a href=\"blabla\"><i>hello</i></b>"));
  }

  @Test
  public void testSanitizeHtmlCharSequence10() {
    assertEquals("<b>&lt;a href=&quot;blabla&quot;&gt;<i>hello<br /></i></b>", Util.sanitizeHtml("<b onload='doSomeNasty()'><a href=\"blabla\"><i>hello<br/></i></b>"));
  }

  @Test
  public void testSanitizeHtmlCharSequenceNull() {
    assertEquals(null, Util.sanitizeHtml(null));
  }

}

{'fraction_non_alphanumeric': 0.22713675213675213, 'fraction_numerical': 0.007264957264957265, 'mean_word_length': 5.735251798561151, 'pattern_counts': {'":': 0, '<': 145, '<?xml version=': 0, '>': 137, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5894163', 'n_tokens_mistral': 1745, 'n_tokens_neox': 1703, 'n_words': 214}