From 1196463dbf4c6ef051dd7f68580fc7d77c5d054c Mon Sep 17 00:00:00 2001 From: Wojciech Sliwka Date: Fri, 1 Feb 2019 07:23:42 +0100 Subject: First part of Tests Issue-ID: VID-385 add first part of new tests for AAI, move some files to proper directory Change-Id: I6600c48d26387faf9e6cd6dbe7107e10428f4b52 Signed-off-by: Wojciech Sliwka --- .../java/org/onap/vid/aai/util/HttpsAuthClientTest.java | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) (limited to 'vid-app-common/src/test/java/org/onap/vid/aai/util/HttpsAuthClientTest.java') diff --git a/vid-app-common/src/test/java/org/onap/vid/aai/util/HttpsAuthClientTest.java b/vid-app-common/src/test/java/org/onap/vid/aai/util/HttpsAuthClientTest.java index aff6c7f76..3336a8af9 100644 --- a/vid-app-common/src/test/java/org/onap/vid/aai/util/HttpsAuthClientTest.java +++ b/vid-app-common/src/test/java/org/onap/vid/aai/util/HttpsAuthClientTest.java @@ -21,13 +21,13 @@ package org.onap.vid.aai.util; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; + import org.mockito.Mock; -import org.mockito.junit.MockitoJUnitRunner; + import org.onap.vid.aai.exceptions.HttpClientBuilderException; import org.onap.vid.exceptions.GenericUncheckedException; +import org.testng.annotations.BeforeMethod; +import org.testng.annotations.Test; import org.togglz.core.manager.FeatureManager; import javax.net.ssl.SSLContext; @@ -35,8 +35,8 @@ import java.util.Optional; import static org.mockito.ArgumentMatchers.anyString; import static org.mockito.Mockito.*; +import static org.mockito.MockitoAnnotations.initMocks; -@RunWith(MockitoJUnitRunner.class) public class HttpsAuthClientTest { @Mock private SystemPropertyHelper systemPropertyHelper; @@ -51,14 +51,15 @@ public class HttpsAuthClientTest { return new HttpsAuthClient(CERT_FILE_PATH, systemPropertyHelper, sslContextProvider, mock(FeatureManager.class)); } - @Before + @BeforeMethod public void setUp() throws Exception { + initMocks(this); when(systemPropertyHelper.getAAITruststoreFilename()).thenReturn(Optional.of("filename")); when(systemPropertyHelper.getDecryptedKeystorePassword()).thenReturn("password"); when(systemPropertyHelper.getDecryptedTruststorePassword()).thenReturn("password"); } - @Test(expected = HttpClientBuilderException.class) + @Test(expectedExceptions = {HttpClientBuilderException.class}) public void testHttpClientBuilderExceptionOnGetClient() throws Exception { //when when(systemPropertyHelper.isClientCertEnabled()).thenReturn(true); -- cgit 1.2.3-korg