diff options
author | Ittay Stern <ittay.stern@att.com> | 2019-08-06 09:54:26 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@onap.org> | 2019-08-06 09:54:26 +0000 |
commit | 14cee6a0d0d1fe5eefb7ccc1eace9fc4cbd8b2eb (patch) | |
tree | 3c8f5cbbd4921798eea6440f4a9fa1fc62b582cc /vid-app-common/src/test | |
parent | 6c8df5bb52b73edf176a03c1c018be196c295c79 (diff) | |
parent | 151d768e923994b3e81ade049d21bf65e931faac (diff) |
Merge "handle errors in change management and tenant isolation"
Diffstat (limited to 'vid-app-common/src/test')
-rw-r--r-- | vid-app-common/src/test/java/org/onap/vid/mso/rest/MsoRestClientTest.java | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/vid-app-common/src/test/java/org/onap/vid/mso/rest/MsoRestClientTest.java b/vid-app-common/src/test/java/org/onap/vid/mso/rest/MsoRestClientTest.java index 8ea4836a2..e4e699d55 100644 --- a/vid-app-common/src/test/java/org/onap/vid/mso/rest/MsoRestClientTest.java +++ b/vid-app-common/src/test/java/org/onap/vid/mso/rest/MsoRestClientTest.java @@ -29,6 +29,7 @@ import static org.mockito.ArgumentMatchers.eq; import static org.mockito.Mockito.when; import static org.mockito.MockitoAnnotations.initMocks; +import com.fasterxml.jackson.core.JsonProcessingException; import io.joshworks.restclient.http.HttpResponse; import io.joshworks.restclient.http.JsonMapper; import org.apache.http.ProtocolVersion; @@ -60,6 +61,7 @@ import java.util.UUID; import static org.mockito.ArgumentMatchers.refEq; import static org.mockito.hamcrest.MockitoHamcrest.argThat; +import static org.onap.vid.utils.KotlinUtilsKt.JACKSON_OBJECT_MAPPER; @ContextConfiguration(classes = {LocalWebConfig.class, SystemProperties.class}) @@ -593,25 +595,23 @@ public class MsoRestClientTest { } @Test - public void shouldProperlyChangeManagementUpdate() { + public void shouldProperlyChangeManagementUpdate() throws JsonProcessingException { // given RequestDetails requestDetails = MsoRestClientTestUtil.generateMockMsoRequest(); RequestDetailsWrapper<RequestDetails> requestDetailsWrapper = new RequestDetailsWrapper<>(requestDetails); String endpoint = "testEndpoint"; - HttpResponse<RequestReferencesContainer> httpResponse = HttpResponse.fallback( - new RequestReferencesContainer( - new RequestReferences())); + RequestReferencesContainer entity = new RequestReferencesContainer(new RequestReferences()); + HttpResponse<String> httpResponse = HttpResponse.fallback(JACKSON_OBJECT_MAPPER.writeValueAsString(entity)); - MsoResponseWrapperInterface expectedResponse = MsoUtil.wrapResponse(httpResponse); - - when(client.post(eq(baseUrl + endpoint), anyMap(), eq(requestDetailsWrapper), eq(RequestReferencesContainer.class))).thenReturn(httpResponse); + when(client.post(eq(baseUrl + endpoint), anyMap(), eq(requestDetailsWrapper), eq(String.class))).thenReturn(httpResponse); // when MsoResponseWrapperInterface response = restClient.changeManagementUpdate(requestDetailsWrapper, endpoint); // then - assertThat(expectedResponse).isEqualToComparingFieldByField(response); + assertThat(response.getEntity()).isEqualToComparingFieldByField(entity); + assertThat(response.getStatus()).isEqualTo(0); } @Test |