public IdentityProvider getEnabledByKey(String key) {
    IdentityProvider identityProvider = providersByKey.get(key);
    if (identityProvider != null && IS_ENABLED_FILTER.test(identityProvider)) {
      return identityProvider;
    }
    throw new IllegalArgumentException(String.format("Identity provider %s does not exist or is not enabled", key));
  }
@Test
  public void fail_on_disabled_provider() {
    IdentityProviderRepository underTest = new IdentityProviderRepository(asList(GITHUB, BITBUCKET, DISABLED));

    assertThatThrownBy(() -> underTest.getEnabledByKey(DISABLED.getKey()))
      .isInstanceOf(IllegalArgumentException.class)
      .hasMessage("Identity provider disabled does not exist or is not enabled");
  }