### Question:
AuthenticationTokenUtils { public static String extractUsername(final AuthenticationToken token) { if (isUsernamePasswordToken(token)) { final UsernamePasswordToken upt = (UsernamePasswordToken) token; return extractField(upt.getUsername(), DEFAULT_USERNAME); } return DEFAULT_TOKEN; } 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 testExtractUsername() throws Exception { final AuthenticationToken nullAuthenticationToken = null; assertEquals(AuthenticationTokenUtils.DEFAULT_TOKEN, AuthenticationTokenUtils.extractUsername(nullAuthenticationToken)); final AuthenticationToken notUsernamePasswordToken = new NotUsernamePasswordToken(); assertEquals(AuthenticationTokenUtils.DEFAULT_TOKEN, AuthenticationTokenUtils.extractUsername(notUsernamePasswordToken)); final UsernamePasswordToken nullUsername = new UsernamePasswordToken(); nullUsername.setUsername(null); assertEquals(AuthenticationTokenUtils.DEFAULT_USERNAME, AuthenticationTokenUtils.extractUsername(nullUsername)); final UsernamePasswordToken positiveUsernamePasswordToken = new UsernamePasswordToken(); final String testUsername = "testUser1"; positiveUsernamePasswordToken.setUsername(testUsername); assertEquals(testUsername, AuthenticationTokenUtils.extractUsername(positiveUsernamePasswordToken)); }