diff options
author | Wojciech Sliwka <wojciech.sliwka@nokia.com> | 2019-04-09 14:10:15 +0200 |
---|---|---|
committer | Wojciech Sliwka <wojciech.sliwka@nokia.com> | 2019-04-10 13:28:26 +0200 |
commit | 9ae2e4cae267c992f5017d91b1e28ee5551f3049 (patch) | |
tree | dc8bfa7df83acc5e733d07722c6c3ba93349557b /vid-app-common/src/test/java/org/onap/vid/mso/RestMsoImplementationTest.java | |
parent | 2e77a83940fbe63305045ae8712404e38e8be185 (diff) |
Inject an SystemPropertiesWrapper instance to MsoClient
Change-Id: Ibbc8540042fc46bd0df42efec99cff5fc2e371a3
Issue-ID: VID-404
Signed-off-by: Wojciech Sliwka <wojciech.sliwka@nokia.com>
Diffstat (limited to 'vid-app-common/src/test/java/org/onap/vid/mso/RestMsoImplementationTest.java')
-rw-r--r-- | vid-app-common/src/test/java/org/onap/vid/mso/RestMsoImplementationTest.java | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/vid-app-common/src/test/java/org/onap/vid/mso/RestMsoImplementationTest.java b/vid-app-common/src/test/java/org/onap/vid/mso/RestMsoImplementationTest.java index 4cba53785..102c89ac1 100644 --- a/vid-app-common/src/test/java/org/onap/vid/mso/RestMsoImplementationTest.java +++ b/vid-app-common/src/test/java/org/onap/vid/mso/RestMsoImplementationTest.java @@ -24,11 +24,11 @@ import io.joshworks.restclient.request.HttpRequest; import org.glassfish.jersey.client.JerseyInvocation; import org.mockito.InjectMocks; import org.mockito.Mock; -import org.onap.portalsdk.core.util.SystemProperties; import org.onap.vid.aai.util.HttpsAuthClient; import org.onap.vid.changeManagement.RequestDetailsWrapper; import org.onap.vid.exceptions.GenericUncheckedException; import org.onap.vid.mso.rest.RequestDetails; +import org.onap.vid.utils.SystemPropertiesWrapper; import org.springframework.http.HttpMethod; import org.springframework.http.HttpStatus; import org.testng.annotations.BeforeClass; @@ -72,15 +72,19 @@ public class RestMsoImplementationTest { @Mock private JerseyInvocation jerseyInvocation; + @Mock + private SystemPropertiesWrapper systemProperties; + @InjectMocks - private RestMsoImplementation restMsoImplementation = new RestMsoImplementation(mockHttpsAuthClient); + private RestMsoImplementation restMsoImplementation = new RestMsoImplementation(mockHttpsAuthClient, systemProperties); - String path = "/test_path/"; - String rawData = "test-row-data"; + private String path = "/test_path/"; + private String rawData = "test-row-data"; @BeforeClass public void setUp(){ initMocks(this); + when(systemProperties.getProperty(MsoProperties.MSO_PASSWORD)).thenReturn("OBF:1ghz1kfx1j1w1m7w1i271e8q1eas1hzj1m4i1iyy1kch1gdz"); } @Test @@ -127,7 +131,8 @@ public class RestMsoImplementationTest { RestObject<HttpRequest> restObject = new RestObject<>(); prepareMocks("",HttpStatus.ACCEPTED.value(),""); - when(mockClient.target(SystemProperties.getProperty(MsoProperties.MSO_SERVER_URL))).thenThrow(new MsoTestException("test-target-exception")); + when(systemProperties.getProperty(MsoProperties.MSO_SERVER_URL)).thenReturn("SAMPLE_URL"); + when(mockClient.target("SAMPLE_URL")).thenThrow(new MsoTestException("test-target-exception")); // when restMsoImplementation.Get(httpRequest, "", restObject,false); @@ -418,4 +423,4 @@ public class RestMsoImplementationTest { } } -}
\ No newline at end of file +} |