diff options
Diffstat (limited to 'components/bbs-event-processor/src/test/java/org/onap/bbs/event/processor/tasks/DmaapCpeAuthenticationConsumerTaskImplTest.java')
-rw-r--r-- | components/bbs-event-processor/src/test/java/org/onap/bbs/event/processor/tasks/DmaapCpeAuthenticationConsumerTaskImplTest.java | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/components/bbs-event-processor/src/test/java/org/onap/bbs/event/processor/tasks/DmaapCpeAuthenticationConsumerTaskImplTest.java b/components/bbs-event-processor/src/test/java/org/onap/bbs/event/processor/tasks/DmaapCpeAuthenticationConsumerTaskImplTest.java index 538ff1de..40bcb65d 100644 --- a/components/bbs-event-processor/src/test/java/org/onap/bbs/event/processor/tasks/DmaapCpeAuthenticationConsumerTaskImplTest.java +++ b/components/bbs-event-processor/src/test/java/org/onap/bbs/event/processor/tasks/DmaapCpeAuthenticationConsumerTaskImplTest.java @@ -26,6 +26,11 @@ import static org.mockito.Mockito.reset; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; +import com.google.gson.Gson; +import com.google.gson.JsonElement; + +import java.util.Optional; + import javax.net.ssl.SSLException; import org.junit.Assert; @@ -62,6 +67,7 @@ class DmaapCpeAuthenticationConsumerTaskImplTest { private static CpeAuthenticationConsumerDmaapModel cpeAuthenticationConsumerDmaapModel; private static DMaaPConsumerReactiveHttpClient dMaaPConsumerReactiveHttpClient; private static String eventsArray; + private static Gson gson = new Gson(); @BeforeAll static void setUp() throws SSLException { @@ -108,22 +114,25 @@ class DmaapCpeAuthenticationConsumerTaskImplTest { @Test void passingEmptyMessage_NothingHappens() throws Exception { - when(dMaaPConsumerReactiveHttpClient.getDMaaPConsumerResponse()).thenReturn(Mono.just("")); + JsonElement empty = gson.toJsonTree(""); + when(dMaaPConsumerReactiveHttpClient.getDMaaPConsumerResponse(Optional.empty())).thenReturn(Mono.just(empty)); StepVerifier.create(dmaapConsumerTask.execute("Sample input")) .expectSubscription() .expectError(EmptyDmaapResponseException.class); - verify(dMaaPConsumerReactiveHttpClient).getDMaaPConsumerResponse(); + verify(dMaaPConsumerReactiveHttpClient).getDMaaPConsumerResponse(Optional.empty()); } @Test void passingNormalMessage_ResponseSucceeds() throws Exception { - when(dMaaPConsumerReactiveHttpClient.getDMaaPConsumerResponse()).thenReturn(Mono.just(eventsArray)); + JsonElement normalEventsArray = gson.toJsonTree(eventsArray); + when(dMaaPConsumerReactiveHttpClient.getDMaaPConsumerResponse(Optional.empty())) + .thenReturn(Mono.just(normalEventsArray)); StepVerifier.create(dmaapConsumerTask.execute("Sample input")) .expectSubscription() .consumeNextWith(e -> Assert.assertEquals(e, cpeAuthenticationConsumerDmaapModel)); - verify(dMaaPConsumerReactiveHttpClient).getDMaaPConsumerResponse(); + verify(dMaaPConsumerReactiveHttpClient).getDMaaPConsumerResponse(Optional.empty()); } private static DmaapConsumerConfiguration testVersionOfDmaapConsumerConfiguration() { |