aboutsummaryrefslogtreecommitdiffstats
path: root/prh-dmaap-client/src/test/java/org/onap/dcaegen2/services/prh/service/producer/DMaaPProducerReactiveHttpClientTest.java
diff options
context:
space:
mode:
authorwasala <przemyslaw.wasala@nokia.com>2018-07-05 14:23:36 +0200
committerwasala <przemyslaw.wasala@nokia.com>2018-08-07 09:52:51 +0200
commite74228673c9c5241a9e901726716f77aacb2711f (patch)
treed4d9b2a4d85d984ce44b3f146a201416bf8b0343 /prh-dmaap-client/src/test/java/org/onap/dcaegen2/services/prh/service/producer/DMaaPProducerReactiveHttpClientTest.java
parenta44fb6f1b9d72ec553ba23038db299b2b8a2016f (diff)
Bug fixes
Improve UnitTest Add changes after review in DmaaPReactiveTasks workflow Change-Id: I920092235528964758014c2d9d229ccd22e69cae Issue-ID: DCAEGEN2-563 Signed-off-by: wasala <przemyslaw.wasala@nokia.com>
Diffstat (limited to 'prh-dmaap-client/src/test/java/org/onap/dcaegen2/services/prh/service/producer/DMaaPProducerReactiveHttpClientTest.java')
-rw-r--r--prh-dmaap-client/src/test/java/org/onap/dcaegen2/services/prh/service/producer/DMaaPProducerReactiveHttpClientTest.java35
1 files changed, 1 insertions, 34 deletions
diff --git a/prh-dmaap-client/src/test/java/org/onap/dcaegen2/services/prh/service/producer/DMaaPProducerReactiveHttpClientTest.java b/prh-dmaap-client/src/test/java/org/onap/dcaegen2/services/prh/service/producer/DMaaPProducerReactiveHttpClientTest.java
index f1fb70b0..20ab64e5 100644
--- a/prh-dmaap-client/src/test/java/org/onap/dcaegen2/services/prh/service/producer/DMaaPProducerReactiveHttpClientTest.java
+++ b/prh-dmaap-client/src/test/java/org/onap/dcaegen2/services/prh/service/producer/DMaaPProducerReactiveHttpClientTest.java
@@ -20,7 +20,6 @@
package org.onap.dcaegen2.services.prh.service.producer;
import static org.mockito.ArgumentMatchers.any;
-import static org.mockito.Mockito.doAnswer;
import static org.mockito.Mockito.doReturn;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.spy;
@@ -36,7 +35,6 @@ import org.onap.dcaegen2.services.prh.config.DmaapPublisherConfiguration;
import org.onap.dcaegen2.services.prh.model.ConsumerDmaapModel;
import org.onap.dcaegen2.services.prh.model.ConsumerDmaapModelForUnitTest;
import org.springframework.http.HttpHeaders;
-import org.springframework.http.HttpStatus;
import org.springframework.web.reactive.function.client.WebClient;
import org.springframework.web.reactive.function.client.WebClient.RequestBodyUriSpec;
import org.springframework.web.reactive.function.client.WebClient.RequestHeadersSpec;
@@ -97,37 +95,6 @@ public class DMaaPProducerReactiveHttpClientTest {
}
@Test
- public void getHttpResponse_HttpResponse4xxClientError() {
- //when
- mockWebClientDependantObject();
-
- doAnswer(invocationOnMock -> Mono.error(new Exception("400")))
- .when(responseSpec).onStatus(HttpStatus::is4xxClientError, e -> Mono.error(new Exception("400")));
- dMaaPProducerReactiveHttpClient.createDMaaPWebClient(webClient);
-
- //then
- StepVerifier.create(dMaaPProducerReactiveHttpClient.getDMaaPProducerResponse(Mono.just(consumerDmaapModel)))
- .expectSubscription()
- .expectError(Exception.class);
-
- }
-
- @Test
- public void getHttpResponse_HttpResponse5xxClientError() {
-
- //when
- mockWebClientDependantObject();
- doAnswer(invocationOnMock -> Mono.error(new Exception("500")))
- .when(responseSpec).onStatus(HttpStatus::is4xxClientError, e -> Mono.error(new Exception("500")));
- dMaaPProducerReactiveHttpClient.createDMaaPWebClient(webClient);
-
- //then
- StepVerifier.create(dMaaPProducerReactiveHttpClient.getDMaaPProducerResponse(Mono.just(consumerDmaapModel)))
- .expectSubscription()
- .expectError(Exception.class);
- }
-
- @Test
public void getHttpResponse_whenURISyntaxExceptionHasBeenThrown() throws URISyntaxException {
//given
dMaaPProducerReactiveHttpClient = spy(dMaaPProducerReactiveHttpClient);
@@ -138,7 +105,7 @@ public class DMaaPProducerReactiveHttpClientTest {
//then
StepVerifier.create(dMaaPProducerReactiveHttpClient.getDMaaPProducerResponse(any())).expectSubscription()
- .expectError(Exception.class);
+ .expectError(Exception.class).verify();
}
private void mockWebClientDependantObject() {