### Question:
HTMLCleaner implements Cleaner { public String clean(String value) { StringBuilder buf = new StringBuilder(value.length()); for (int ix = 0; ix < value.length(); ix++) { char ch = value.charAt(ix); if (ch != '&') { buf.append(ch); continue; } ch = value.charAt(++ix); if (ch == '#') { ix++; if (value.charAt(ix) == 'x') throw new UnsupportedOperationException("Don't support &#x...;"); int pos = ix; for (; ix < value.length() && value.charAt(ix) != ';'; ix++) ; ch = (char) Integer.parseInt(value.substring(pos, ix)); buf.append(ch); } else { int pos = ix; for (; ix < value.length() && value.charAt(ix) != ';'; ix++) ; String v = entities.get(value.substring(pos, ix)); buf.append(v); } } return buf.toString(); }  String clean(String value);  }### Answer:
@Test public void testEmpty() { assertEquals("", cleaner.clean("")); }
@Test public void testSingleChar() { assertEquals("a", cleaner.clean("a")); }
@Test public void testSingleEntity() { assertEquals("ralf hartmut g\u00FCting", cleaner.clean("ralf hartmut g&#252;ting")); }
@Test public void testFirst() { assertEquals("ABC", cleaner.clean("&#65;BC")); }
@Test public void testLast() { assertEquals("ABC", cleaner.clean("AB&#67;")); }
@Test public void testSingleNamedEntity() { assertEquals("the vldb journal \u2014 the international journal on very large data bases", cleaner.clean("the vldb journal &mdash; the international journal on very large data bases")); }
@Test public void testThreeEntities() { assertEquals("ricardo jim\u00e9nez-peris, m. pati\u00f1o-mart\u00ednez, gustavo alonso, bettina kemme", cleaner.clean("ricardo jim&#233;nez-peris, m. pati&#241;o-mart&#237;nez, gustavo alonso, bettina kemme")); }