@Test public void testTwoPartCheckConfiguredExceptionMessageOnNullProvider() { thrown.expect(NullPointerException.class); thrown.expectMessage("provider cannot be null"); checkValidForProvider(ListCredentials.from("user", "pass"), null); }
public static Credentials checkValidForProvider(Credentials creds, denominator.Provider provider) { checkNotNull(provider, "provider cannot be null"); if (isAnonymous(creds) && provider.credentialTypeToParameterNames().isEmpty()) { return AnonymousCredentials.INSTANCE; } else if (creds instanceof Map) { if (credentialConfigurationHasKeys(provider, Map.class.cast(creds).keySet())) { return creds; } } else if (creds instanceof List) { if (credentialConfigurationHasPartCount(provider, List.class.cast(creds).size())) { return creds; } } throw new IllegalArgumentException(exceptionMessage(creds, provider)); }
CredentialsConfiguration { public static Credentials checkValidForProvider(Credentials creds, denominator.Provider provider) { checkNotNull(provider, "provider cannot be null"); if (isAnonymous(creds) && provider.credentialTypeToParameterNames().isEmpty()) { return AnonymousCredentials.INSTANCE; } else if (creds instanceof Map) { if (credentialConfigurationHasKeys(provider, Map.class.cast(creds).keySet())) { return creds; } } else if (creds instanceof List) { if (credentialConfigurationHasPartCount(provider, List.class.cast(creds).size())) { return creds; } } throw new IllegalArgumentException(exceptionMessage(creds, provider)); } }
CredentialsConfiguration { public static Credentials checkValidForProvider(Credentials creds, denominator.Provider provider) { checkNotNull(provider, "provider cannot be null"); if (isAnonymous(creds) && provider.credentialTypeToParameterNames().isEmpty()) { return AnonymousCredentials.INSTANCE; } else if (creds instanceof Map) { if (credentialConfigurationHasKeys(provider, Map.class.cast(creds).keySet())) { return creds; } } else if (creds instanceof List) { if (credentialConfigurationHasPartCount(provider, List.class.cast(creds).size())) { return creds; } } throw new IllegalArgumentException(exceptionMessage(creds, provider)); } private  CredentialsConfiguration(); }
CredentialsConfiguration { public static Credentials checkValidForProvider(Credentials creds, denominator.Provider provider) { checkNotNull(provider, "provider cannot be null"); if (isAnonymous(creds) && provider.credentialTypeToParameterNames().isEmpty()) { return AnonymousCredentials.INSTANCE; } else if (creds instanceof Map) { if (credentialConfigurationHasKeys(provider, Map.class.cast(creds).keySet())) { return creds; } } else if (creds instanceof List) { if (credentialConfigurationHasPartCount(provider, List.class.cast(creds).size())) { return creds; } } throw new IllegalArgumentException(exceptionMessage(creds, provider)); } private  CredentialsConfiguration(); static Object anonymous(); static Object credentials(Object firstPart, Object secondPart); static Object credentials(Object firstPart, Object secondPart, Object thirdPart); static Object credentials(Credentials credentials); static Credentials checkValidForProvider(Credentials creds,
                                                  denominator.Provider provider); static String exceptionMessage(Credentials input, denominator.Provider provider); }
CredentialsConfiguration { public static Credentials checkValidForProvider(Credentials creds, denominator.Provider provider) { checkNotNull(provider, "provider cannot be null"); if (isAnonymous(creds) && provider.credentialTypeToParameterNames().isEmpty()) { return AnonymousCredentials.INSTANCE; } else if (creds instanceof Map) { if (credentialConfigurationHasKeys(provider, Map.class.cast(creds).keySet())) { return creds; } } else if (creds instanceof List) { if (credentialConfigurationHasPartCount(provider, List.class.cast(creds).size())) { return creds; } } throw new IllegalArgumentException(exceptionMessage(creds, provider)); } private  CredentialsConfiguration(); static Object anonymous(); static Object credentials(Object firstPart, Object secondPart); static Object credentials(Object firstPart, Object secondPart, Object thirdPart); static Object credentials(Credentials credentials); static Credentials checkValidForProvider(Credentials creds,
                                                  denominator.Provider provider); static String exceptionMessage(Credentials input, denominator.Provider provider);  }