X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=webapp-backend%2Fsrc%2Ftest%2Fjava%2Forg%2Foransc%2Fportal%2Fnonrtric%2Fcontrolpanel%2Fcontroller%2FPortalRestCentralServiceTest.java;h=d9919a5e38b27bc58f8d56e82522fa3a62aee583;hb=81ff72c1ab1f0606ec886ab21795dbc6ae54ff7f;hp=94e7eeb975e4cdc08fc7513df32d7071243217e6;hpb=a904ab90dae9dd332366fa184df755612a787a01;p=portal%2Fnonrtric-controlpanel.git diff --git a/webapp-backend/src/test/java/org/oransc/portal/nonrtric/controlpanel/controller/PortalRestCentralServiceTest.java b/webapp-backend/src/test/java/org/oransc/portal/nonrtric/controlpanel/controller/PortalRestCentralServiceTest.java index 94e7eeb..d9919a5 100644 --- a/webapp-backend/src/test/java/org/oransc/portal/nonrtric/controlpanel/controller/PortalRestCentralServiceTest.java +++ b/webapp-backend/src/test/java/org/oransc/portal/nonrtric/controlpanel/controller/PortalRestCentralServiceTest.java @@ -30,32 +30,36 @@ import org.junit.jupiter.api.Test; import org.onap.portalsdk.core.onboarding.util.PortalApiConstants; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import org.springframework.http.ResponseEntity; import org.springframework.web.reactive.function.client.WebClientResponseException; +import reactor.core.publisher.Mono; -public class PortalRestCentralServiceTest extends AbstractControllerTest { +class PortalRestCentralServiceTest extends AbstractControllerTest { private static final Logger logger = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass()); @Test - public void getAnalyticsTest() { + void getAnalyticsTest() { // paths are hardcoded here exactly like the EPSDK-FW library :( URI uri = buildUri(null, PortalApiConstants.API_PREFIX, "/analytics"); logger.info("Invoking {}", uri); + Mono> forEntity = webClient.getForEntity(uri.toString()); WebClientResponseException e = assertThrows(WebClientResponseException.class, () -> { - webClient.getForEntity(uri.toString()).block(); + forEntity.block(); }); // No Portal is available so this always fails Assertions.assertTrue(e.getStatusCode().is4xxClientError()); } @Test - public void getErrorPageTest() { + void getErrorPageTest() { // Send unauthorized request URI uri = buildUri(null, "/favicon.ico"); logger.info("Invoking {}", uri); + Mono> forEntity = webClient.getForEntity(uri.toString()); WebClientResponseException e = assertThrows(WebClientResponseException.class, () -> { - webClient.getForEntity(uri.toString()).block(); + forEntity.block(); }); Assertions.assertTrue(e.getStatusCode().is4xxClientError()); Assertions.assertTrue(e.getResponseBodyAsString().contains("Static error page"));