diff options
author | Eylon Malin <eylon.malin@intl.att.com> | 2019-08-05 23:38:18 +0300 |
---|---|---|
committer | Eylon Malin <eylon.malin@intl.att.com> | 2019-08-06 12:32:00 +0300 |
commit | 151d768e923994b3e81ade049d21bf65e931faac (patch) | |
tree | 797fe529428d0dc399992491acd584de58b3107d /vid-app-common/src/test | |
parent | 84d0b4b11a1ae178a6759ce423ce2bd62315ce15 (diff) |
handle errors in change management and tenant isolation
use more tolerance way for parsing responses from MSO so VID can handle
error responses with html body
Issue-ID: VID-378
Signed-off-by: Eylon Malin <eylon.malin@intl.att.com>
Change-Id: I72741ec1bf636a1200e8ecbd684ab1f3b2ab332a
Signed-off-by: Ittay Stern <ittay.stern@att.com>
Signed-off-by: Eylon Malin <eylon.malin@intl.att.com>
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 |