### Question:
CheckPasswordPolicy implements IoHandlerCommand { boolean isValidUsernameSubstring( String username, String password, int tokenSize ) { String[] tokens = username.split( "[^a-zA-Z]" ); for ( int ii = 0; ii < tokens.length; ii++ ) { if ( tokens[ii].length() >= tokenSize && password.matches( "(?i).*" + tokens[ii] + ".*" ) ) { return false; } } return true; }  void execute( NextCommand next, IoSession session, Object message );  }### Answer:
@Test public void testPrincipalAsUsername() { String username = new KerberosPrincipal( "erodriguez@EXAMPLE.COM" ).getName(); String password1 = "d1r3ct0rY"; String password2 = "ERodriguez@d1r3ct0rY"; String password3 = "Example@d1r3ct0rY"; assertTrue( policy.isValidUsernameSubstring( username, password1, tokenSize ) ); assertFalse( policy.isValidUsernameSubstring( username, password2, tokenSize ) ); assertFalse( policy.isValidUsernameSubstring( username, password3, tokenSize ) ); }