### Question:
AuthenticationTokenUtils { public static String generateUnsuccessfulAuthenticationMessage(final AuthenticationToken token) { final String username = extractUsername(token); final String remoteHostname = extractHostname(token); return String.format("Unsuccessful authentication attempt by %s from %s", username, remoteHostname); } private  AuthenticationTokenUtils(); static boolean isUsernamePasswordToken(final AuthenticationToken token); static String extractUsername(final AuthenticationToken token); static String extractHostname(final AuthenticationToken token); static String generateUnsuccessfulAuthenticationMessage(final AuthenticationToken token); static String generateSuccessfulAuthenticationMessage(final AuthenticationToken token);  }### Answer:
@Test public void testGenerateUnsuccessfulAuthenticationMessage() throws Exception { final UsernamePasswordToken unsuccessfulToken = new UsernamePasswordToken(); unsuccessfulToken.setUsername("unsuccessfulUser1"); unsuccessfulToken.setHost("unsuccessfulHost1"); assertEquals("Unsuccessful authentication attempt by unsuccessfulUser1 from unsuccessfulHost1", AuthenticationTokenUtils.generateUnsuccessfulAuthenticationMessage(unsuccessfulToken)); }