GoogleAuthHandler implements AuthHandler { @Nullable @Override public AuthProvider providerFor(@Nullable String strategy, @NonNull String connection) { if ("google-oauth2".equals(strategy)) { return provider; } return null; } GoogleAuthHandler(@NonNull AuthenticationAPIClient apiClient, @NonNull String serverClientId);  GoogleAuthHandler(@NonNull GoogleAuthProvider provider); @Nullable @Override AuthProvider providerFor(@Nullable String strategy, @NonNull String connection);  }
@Test public void shouldGetFacebookProvider() throws Exception { final AuthProvider p = handler.providerFor("google-oauth2", "google-oauth2"); assertThat(p, is(notNullValue())); assertThat(p, is(CoreMatchers.instanceOf(GoogleAuthProvider.class))); assertThat(p, is(equalTo((AuthProvider) provider))); }
@Test public void shouldGetNullProvider() throws Exception { final AuthProvider p = handler.providerFor("some-strategy", "some-connection"); assertThat(p, is(nullValue())); }