@Test void givenNoBypassSchemeX509Authentication_whenX509Authenticated_thenWithout() { Authentication auth = mock(Authentication.class); when(auth.isAuthenticated()).thenReturn(true); when(auth.getCredentials()).thenReturn(mock(X509Certificate.class)); SecurityContextHolder.getContext().setAuthentication(auth); assertThat(chooser.chooseClient(), is(clientWithoutCertificate)); }
public CloseableHttpClient chooseClient() { if (isRequestToSign()) { return clientWithCertificate; } else { return clientWithoutCertificate; } }
HttpClientChooser { public CloseableHttpClient chooseClient() { if (isRequestToSign()) { return clientWithCertificate; } else { return clientWithoutCertificate; } } }
HttpClientChooser { public CloseableHttpClient chooseClient() { if (isRequestToSign()) { return clientWithCertificate; } else { return clientWithoutCertificate; } } HttpClientChooser(CloseableHttpClient clientWithoutCertificate, CloseableHttpClient clientWithCertificate); }
HttpClientChooser { public CloseableHttpClient chooseClient() { if (isRequestToSign()) { return clientWithCertificate; } else { return clientWithoutCertificate; } } HttpClientChooser(CloseableHttpClient clientWithoutCertificate, CloseableHttpClient clientWithCertificate); CloseableHttpClient chooseClient(); }
HttpClientChooser { public CloseableHttpClient chooseClient() { if (isRequestToSign()) { return clientWithCertificate; } else { return clientWithoutCertificate; } } HttpClientChooser(CloseableHttpClient clientWithoutCertificate, CloseableHttpClient clientWithCertificate); CloseableHttpClient chooseClient();  }