### Question:
KerberosToken implements AuthenticationToken { static void validateAuthMethod(AuthenticationMethod authMethod) { checkArgument( authMethod == AuthenticationMethod.KERBEROS || authMethod == AuthenticationMethod.PROXY, "KerberosToken expects KERBEROS or PROXY authentication for the current " + "UserGroupInformation user. Saw " + authMethod); } KerberosToken(String principal);  KerberosToken(String principal, File keytab);  KerberosToken(); @Override KerberosToken clone(); @Override boolean equals(Object obj); String getPrincipal(); File getKeytab(); @Override void write(DataOutput out); @Override void readFields(DataInput in); @Override synchronized void destroy(); @Override boolean isDestroyed(); @Override void init(Properties properties); @Override Set<TokenProperty> getProperties(); @Override int hashCode(); static final String CLASS_NAME; }### Answer:
@Test public void testAuthMethodAcceptance() { Set<AuthenticationMethod> allowedMethods = new HashSet<>(Arrays.asList(AuthenticationMethod.KERBEROS, AuthenticationMethod.PROXY)); for (AuthenticationMethod authMethod : AuthenticationMethod.values()) { final boolean allowable = allowedMethods.contains(authMethod); try { KerberosToken.validateAuthMethod(authMethod); if (!allowable) { fail(authMethod + " should have triggered a thrown exception but it did not"); } } catch (IllegalArgumentException e) { if (allowable) { fail(authMethod + " should not have triggered a thrown exception"); } } } }