private AAIRestApiProvider aaiRestApiProvider;
@Mock
private HostnameVerifier hostnameVerifier;
- private AaiSecurityProvider aaiSecurityProvider = spy(new AaiSecurityProvider());
+ private AaiSecurityProvider aaiSecurityProviderReal = new AaiSecurityProvider();
+ private AaiSecurityProvider aaiSecurityProvider = spy(aaiSecurityProviderReal);
@Before
public void init() {
*/
@Test
public void testApiClientBuilder() throws Exception {
- setField(aaiSecurityProvider, "skipCertificateVerification", true);
- setField(aaiSecurityProvider, "skipHostnameVerification", true);
+ when(aaiSecurityProvider.skipCertificateVerification()).thenReturn(true);
+ when(aaiSecurityProvider.skipHostnameVerification()).thenReturn(true);
setFieldWithPropertyAnnotation(aaiRestApiProvider, "${aaiUsername}", "username");
setFieldWithPropertyAnnotation(aaiRestApiProvider, "${aaiPassword}", "aaiPassword");
ResultCaptor<SSLSocketFactory> sslSocketFactoryResultCaptor = new ResultCaptor<>();
*/
@Test
public void testApiClientBuilderMissingSlash() throws Exception {
- setField(aaiSecurityProvider, "skipCertificateVerification", true);
- setField(aaiSecurityProvider, "skipHostnameVerification", true);
+ when(aaiSecurityProvider.skipCertificateVerification()).thenReturn(true);
+ when(aaiSecurityProvider.skipHostnameVerification()).thenReturn(true);
setFieldWithPropertyAnnotation(aaiRestApiProvider, "${aaiUsername}", "username");
setFieldWithPropertyAnnotation(aaiRestApiProvider, "${aaiPassword}", "aaiPassword");
ResultCaptor<SSLSocketFactory> sslSocketFactoryResultCaptor = new ResultCaptor<>();
*/
@Test
public void testApiClientBuilderForCloud() throws Exception {
- setField(aaiSecurityProvider, "skipCertificateVerification", true);
- setField(aaiSecurityProvider, "skipHostnameVerification", true);
+ when(aaiSecurityProvider.skipCertificateVerification()).thenReturn(true);
+ when(aaiSecurityProvider.skipHostnameVerification()).thenReturn(true);
setFieldWithPropertyAnnotation(aaiRestApiProvider, "${aaiUsername}", "username");
setFieldWithPropertyAnnotation(aaiRestApiProvider, "${aaiPassword}", "aaiPassword");
ResultCaptor<SSLSocketFactory> sslSocketFactoryResultCaptor = new ResultCaptor<>();
*/
@Test
public void testApiClientBuilderForExternalSystems() throws Exception {
- setField(aaiSecurityProvider, "skipCertificateVerification", true);
- setField(aaiSecurityProvider, "skipHostnameVerification", true);
+ when(aaiSecurityProvider.skipCertificateVerification()).thenReturn(true);
+ when(aaiSecurityProvider.skipHostnameVerification()).thenReturn(true);
setFieldWithPropertyAnnotation(aaiRestApiProvider, "${aaiUsername}", "username");
setFieldWithPropertyAnnotation(aaiRestApiProvider, "${aaiPassword}", "aaiPassword");
ResultCaptor<SSLSocketFactory> sslSocketFactoryResultCaptor = new ResultCaptor<>();