diff options
author | wasala <przemyslaw.wasala@nokia.com> | 2018-07-10 11:47:01 +0200 |
---|---|---|
committer | wasala <przemyslaw.wasala@nokia.com> | 2018-08-07 10:18:47 +0200 |
commit | c1f0313e1f0085afb813d1ba3e2d7fcc71b5833d (patch) | |
tree | 88bece267217d7a1d3d921c85aad2c01778e98f9 /prh-dmaap-client/src/test/java/org/onap/dcaegen2/services/prh/service/producer/DMaaPProducerReactiveHttpClientTest.java | |
parent | 01578219e470c4cd9b6181c0615759a7118c0abb (diff) |
Checkstyle violations
*Correction of violations
without javadoc
Change-Id: Ida177bf32a58605e74feae5fab22198228e970ce
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.java | 43 |
1 files changed, 22 insertions, 21 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 20ab64e5..b5e730a0 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 @@ -17,6 +17,7 @@ * limitations under the License. * ============LICENSE_END========================================================= */ + package org.onap.dcaegen2.services.prh.service.producer; import static org.mockito.ArgumentMatchers.any; @@ -29,7 +30,7 @@ import static org.springframework.web.reactive.function.client.ExchangeFilterFun import java.net.URI; import java.net.URISyntaxException; import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import org.onap.dcaegen2.services.prh.config.DmaapPublisherConfiguration; import org.onap.dcaegen2.services.prh.model.ConsumerDmaapModel; @@ -45,21 +46,20 @@ import reactor.test.StepVerifier; /** * @author <a href="mailto:przemyslaw.wasala@nokia.com">Przemysław Wąsala</a> on 7/4/18 */ -public class DMaaPProducerReactiveHttpClientTest { +class DMaaPProducerReactiveHttpClientTest { - private static DMaaPProducerReactiveHttpClient dMaaPProducerReactiveHttpClient; + private DMaaPProducerReactiveHttpClient dmaapProducerReactiveHttpClient; - private static DmaapPublisherConfiguration dmaapPublisherConfigurationMock = mock( + private DmaapPublisherConfiguration dmaapPublisherConfigurationMock = mock( DmaapPublisherConfiguration.class); - private static final Integer RESPONSE_SUCCESS = 200; - private static ConsumerDmaapModel consumerDmaapModel = new ConsumerDmaapModelForUnitTest(); - private static WebClient webClient = mock(WebClient.class); - private static RequestBodyUriSpec requestBodyUriSpec; - private static ResponseSpec responseSpec; + private ConsumerDmaapModel consumerDmaapModel = new ConsumerDmaapModelForUnitTest(); + private WebClient webClient = mock(WebClient.class); + private RequestBodyUriSpec requestBodyUriSpec; + private ResponseSpec responseSpec; - @BeforeAll - public static void setUp() { + @BeforeEach + void setUp() { when(dmaapPublisherConfigurationMock.dmaapHostName()).thenReturn("54.45.33.2"); when(dmaapPublisherConfigurationMock.dmaapProtocol()).thenReturn("https"); when(dmaapPublisherConfigurationMock.dmaapPortNumber()).thenReturn(1234); @@ -68,7 +68,7 @@ public class DMaaPProducerReactiveHttpClientTest { when(dmaapPublisherConfigurationMock.dmaapContentType()).thenReturn("application/json"); when(dmaapPublisherConfigurationMock.dmaapTopicName()).thenReturn("pnfReady"); - dMaaPProducerReactiveHttpClient = new DMaaPProducerReactiveHttpClient(dmaapPublisherConfigurationMock); + dmaapProducerReactiveHttpClient = new DMaaPProducerReactiveHttpClient(dmaapPublisherConfigurationMock); webClient = spy(WebClient.builder() .defaultHeader(HttpHeaders.CONTENT_TYPE, dmaapPublisherConfigurationMock.dmaapContentType()) @@ -80,31 +80,32 @@ public class DMaaPProducerReactiveHttpClientTest { } @Test - public void getHttpResponse_Success() { + void getHttpResponse_Success() { //given - Mono<Integer> expectedResult = Mono.just(RESPONSE_SUCCESS); + Integer responseSuccess = 200; + Mono<Integer> expectedResult = Mono.just(responseSuccess); //when mockWebClientDependantObject(); doReturn(expectedResult).when(responseSpec).bodyToMono(String.class); - dMaaPProducerReactiveHttpClient.createDMaaPWebClient(webClient); - Mono<String> response = dMaaPProducerReactiveHttpClient.getDMaaPProducerResponse(Mono.just(consumerDmaapModel)); + dmaapProducerReactiveHttpClient.createDMaaPWebClient(webClient); + Mono<String> response = dmaapProducerReactiveHttpClient.getDMaaPProducerResponse(Mono.just(consumerDmaapModel)); //then Assertions.assertEquals(response.block(), expectedResult.block()); } @Test - public void getHttpResponse_whenURISyntaxExceptionHasBeenThrown() throws URISyntaxException { + void getHttpResponse_whenUriSyntaxExceptionHasBeenThrown() throws URISyntaxException { //given - dMaaPProducerReactiveHttpClient = spy(dMaaPProducerReactiveHttpClient); + dmaapProducerReactiveHttpClient = spy(dmaapProducerReactiveHttpClient); //when when(webClient.post()).thenReturn(requestBodyUriSpec); - dMaaPProducerReactiveHttpClient.createDMaaPWebClient(webClient); - when(dMaaPProducerReactiveHttpClient.getUri()).thenThrow(URISyntaxException.class); + dmaapProducerReactiveHttpClient.createDMaaPWebClient(webClient); + when(dmaapProducerReactiveHttpClient.getUri()).thenThrow(URISyntaxException.class); //then - StepVerifier.create(dMaaPProducerReactiveHttpClient.getDMaaPProducerResponse(any())).expectSubscription() + StepVerifier.create(dmaapProducerReactiveHttpClient.getDMaaPProducerResponse(any())).expectSubscription() .expectError(Exception.class).verify(); } |