IdentityProviderConfigValidationDelegator implements IdentityProviderConfigValidator { @Override public void validate(IdentityProvider<? extends AbstractIdentityProviderDefinition> provider) { if (provider == null) { throw new IllegalArgumentException("Provider cannot be null"); } String type = provider.getType(); switch (type) { case OAUTH20: case OIDC10: this.externalOAuthIdentityProviderConfigValidator.validate(provider); break; case UAA: this.uaaIdentityProviderConfigValidator.validate(provider); break; case LDAP: this.ldapIdentityProviderConfigValidator.validate(provider); break; } } IdentityProviderConfigValidationDelegator(
            final ExternalOAuthIdentityProviderConfigValidator externalOAuthIdentityProviderConfigValidator,
            final UaaIdentityProviderConfigValidator uaaIdentityProviderConfigValidator,
            final LdapIdentityProviderConfigValidator ldapIdentityProviderConfigValidator
    ); @Override void validate(IdentityProvider<? extends AbstractIdentityProviderDefinition> provider);  }
@Test void null_identity_provider() { assertThrowsWithMessageThat( IllegalArgumentException.class, () -> identityProviderConfigValidationDelegator.validate(null), org.hamcrest.Matchers.is("Provider cannot be null") ); }
@Test void uaa_validator_with_nodefinition_is_invoked() { identityProvider.setType(UAA); identityProviderConfigValidationDelegator.validate(identityProvider); verify(mockUaaIdentityProviderConfigValidator).validate(identityProvider); verifyNoInteractions(mockLdapIdentityProviderConfigValidator); verifyNoInteractions(mockExternalOAuthIdentityProviderConfigValidator); }
@Test void ldap_validator_with_definition_is_invoked() { identityProvider.setType(LDAP); identityProviderConfigValidationDelegator.validate(identityProvider); verifyNoInteractions(mockUaaIdentityProviderConfigValidator); verify(mockLdapIdentityProviderConfigValidator).validate(identityProvider); verifyNoInteractions(mockExternalOAuthIdentityProviderConfigValidator); }