From b1c5d01900ea67f1ed27b4f66020912a0b29aa37 Mon Sep 17 00:00:00 2001 From: pwielebs Date: Mon, 30 Apr 2018 17:15:58 +0200 Subject: Response handlers for DmaaP clients changed Change-Id: I625521013aa02e6709be95ad7b3443707a549f05 Issue-ID: DCAEGEN2-451 Signed-off-by: pwielebs --- .../service/producer/ExtendedDmaapProducerHttpClientImplTest.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'prh-dmaap-client/src/test/java/org/onap') diff --git a/prh-dmaap-client/src/test/java/org/onap/dcaegen2/services/service/producer/ExtendedDmaapProducerHttpClientImplTest.java b/prh-dmaap-client/src/test/java/org/onap/dcaegen2/services/service/producer/ExtendedDmaapProducerHttpClientImplTest.java index 67c58f55..0560432b 100644 --- a/prh-dmaap-client/src/test/java/org/onap/dcaegen2/services/service/producer/ExtendedDmaapProducerHttpClientImplTest.java +++ b/prh-dmaap-client/src/test/java/org/onap/dcaegen2/services/service/producer/ExtendedDmaapProducerHttpClientImplTest.java @@ -47,6 +47,8 @@ public class ExtendedDmaapProducerHttpClientImplTest { private static Optional expectedResult = Optional.empty(); private static final String JSON_MESSAGE = "{ \"ipaddress-v4-oam\": \"11.22.33.44\" }"; + private static final String RESPONSE_SUCCESS = "200"; + private static final String RESPONSE_FAILURE = "404"; @BeforeAll public static void init() throws NoSuchFieldException, IllegalAccessException { @@ -70,7 +72,7 @@ public class ExtendedDmaapProducerHttpClientImplTest { @Test public void getHttpResponsePost_success() throws IOException { - expectedResult = Optional.of(JSON_MESSAGE); + expectedResult = Optional.of(RESPONSE_SUCCESS); when(closeableHttpClientMock.execute(any(HttpPost.class), any(ResponseHandler.class))) .thenReturn(expectedResult); @@ -81,8 +83,8 @@ public class ExtendedDmaapProducerHttpClientImplTest { } @Test - public void getExtendedDetails_returnsNull() throws IOException { - expectedResult = Optional.of(JSON_MESSAGE); + public void getExtendedDetails_returnsFailure() throws IOException { + expectedResult = Optional.of(RESPONSE_FAILURE); when(closeableHttpClientMock.execute(any(HttpPost.class), any(ResponseHandler.class))). thenReturn(Optional.empty()); Optional actualResult = objectUnderTest.getHttpProducerResponse(requestDetailsMock); -- cgit 1.2.3-korg