### Question:
UtilHtmlSanitizer { public void sanitizeConnectionParameters( IDatabaseConnection connection ) { String safeName = safeEscapeHtml( connection.getName() ); connection.setName( safeName ); String safeDbName = safeEscapeHtml( connection.getDatabaseName() ); connection.setDatabaseName( safeDbName ); String safeDbPort = safeEscapeHtml( connection.getDatabasePort() ); connection.setDatabasePort( safeDbPort ); String safeHostname = safeEscapeHtml( connection.getHostname() ); connection.setHostname( safeHostname ); String safePassword = safeEscapeHtml( connection.getPassword() ); connection.setPassword( safePassword ); String safeUsername = safeEscapeHtml( connection.getUsername() ); connection.setUsername( safeUsername ); } private  UtilHtmlSanitizer(); static synchronized UtilHtmlSanitizer getInstance(); void sanitizeConnectionParameters( IDatabaseConnection connection ); void unsanitizeConnectionParameters( IDatabaseConnection connection ); String safeEscapeHtml( String html ); String escape( String stringToEscape );  }### Answer:
@Test public void testSanitizeConnectionParameters() throws Exception { DatabaseConnection connection = new DatabaseConnection(); connection.setName( "<font color=\"red\">\"AAAAAAAAAAAA\"" ); sanitizer.sanitizeConnectionParameters( connection ); assertEquals( "&lt;font color=&quot;red&quot;&gt;&quot;AAAAAAAAAAAA&quot;", connection.getName() ); connection.setName( "<input type=\"button\" onClick=\"dangerous code\">" ); sanitizer.sanitizeConnectionParameters( connection ); assertEquals( "&lt;input type=&quot;button&quot; onClick=&quot;dangerous code&quot;&gt;", connection.getName() ); connection.setName( "<a href=\"url\">link text" ); sanitizer.sanitizeConnectionParameters( connection ); assertEquals( "&lt;a href=&quot;url&quot;&gt;link text", connection.getName() ); assertNull( connection.getDatabaseName() ); }