### Question:
HtmlUtils { public static String escapeAttribute(String value) { StringBuilder escaped = new StringBuilder(); for (int i = 0; i < value.length(); i++) { char chr = value.charAt(i); if (chr == '<') { escaped.append("&lt;"); } else if (chr == '>') { escaped.append("&gt;"); } else if (chr == '"') { escaped.append("&quot;"); } else if (chr == '\'') { escaped.append("&apos;"); } else if (chr == '&') { escaped.append("&amp;"); } else { escaped.append(chr); } } return escaped.toString(); }  static String escapeAttribute(String value);  }### Answer:
@Test public void escapeAttribute() { Assert.assertEquals("1&lt;2", HtmlUtils.escapeAttribute("1<2")); Assert.assertEquals("2&lt;3&amp;&amp;3&gt;2", HtmlUtils.escapeAttribute("2<3&&3>2") ); Assert.assertEquals("test", HtmlUtils.escapeAttribute("test")); Assert.assertEquals("&apos;test&apos;", HtmlUtils.escapeAttribute("\'test\'")); Assert.assertEquals("&quot;test&quot;", HtmlUtils.escapeAttribute("\"test\"")); }