CredentialTypes { public static <T> String credentialTypeOf(T input) { Class<?> authenticationType = input.getClass(); checkArgument(authenticationType.isAnnotationPresent(CredentialType.class), "programming error: %s should have annotation %s", authenticationType, CredentialType.class.getName()); return authenticationType.getAnnotation(CredentialType.class).value(); }  static String credentialTypeOf(T input); static Map<String, T> indexByCredentialType(Iterable<T> iterable); static final String API_ACCESS_KEY_CREDENTIALS; static final String PASSWORD_CREDENTIALS; }
@Test(expectedExceptions = IllegalArgumentException.class) public void testCredentialTypeOfWithoutAnnotation() { CredentialTypes.credentialTypeOf(""); }