EntityReferences { public String namedEntityToString(String name) { if (Strings.isNullOrEmpty(name)) { return ""; } String s = ""; List<String> entityReferences = nameToEntityReferences(name); if (entityReferences.isEmpty() && name.startsWith("#")) { entityReferences = ImmutableList.of(name); } for (String reference : entityReferences) { try { char c = (char) Integer.parseInt(reference.substring(1)); s += c; } catch (NumberFormatException e) { } } return s; } private  EntityReferences(); static EntityReferences instance(); List<String> nameToEntityReferences(String name); String namedEntityToString(String name);  }
@Test public void namedEntityToString() { assertNamedEntityToString("&", "amp"); assertNamedEntityToString("≶", "LessGreater"); assertNamedEntityToString("Ã", "#195"); }