X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=datafilecollector%2Fsrc%2Ftest%2Fjava%2Forg%2Foran%2Fdatafile%2Fcontrollers%2FStatusControllerTest.java;h=39d4dc1f8fe7425fc5dfdef058c6901516a05dec;hb=HEAD;hp=182609676a37cbbb61a95045cb7b4b5f1d5fb337;hpb=d806dbef4f43bb9c631c818e96c1a39e440c5e6c;p=nonrtric%2Fplt%2Franpm.git diff --git a/datafilecollector/src/test/java/org/oran/datafile/controllers/StatusControllerTest.java b/datafilecollector/src/test/java/org/oran/datafile/controllers/StatusControllerTest.java index 1826096..39d4dc1 100644 --- a/datafilecollector/src/test/java/org/oran/datafile/controllers/StatusControllerTest.java +++ b/datafilecollector/src/test/java/org/oran/datafile/controllers/StatusControllerTest.java @@ -21,6 +21,7 @@ package org.oran.datafile.controllers; +import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertTrue; import static org.mockito.Mockito.doReturn; @@ -32,11 +33,12 @@ import org.mockito.junit.jupiter.MockitoExtension; import org.oran.datafile.model.Counters; import org.oran.datafile.tasks.CollectAndReportFiles; import org.springframework.http.HttpHeaders; +import org.springframework.http.HttpStatusCode; import org.springframework.http.ResponseEntity; import reactor.core.publisher.Mono; @ExtendWith(MockitoExtension.class) -public class StatusControllerTest { +class StatusControllerTest { @Mock CollectAndReportFiles scheduledTasksMock; @@ -48,7 +50,7 @@ public class StatusControllerTest { } @Test - public void heartbeat_success() { + void heartbeat_success() { HttpHeaders httpHeaders = new HttpHeaders(); Mono> result = controllerUnderTest.heartbeat(httpHeaders); @@ -58,7 +60,7 @@ public class StatusControllerTest { } @Test - public void status() { + void status() { Counters counters = new Counters(); doReturn(counters).when(scheduledTasksMock).getCounters(); @@ -67,6 +69,8 @@ public class StatusControllerTest { Mono> result = controllerUnderTest.status(httpHeaders); String body = result.block().getBody(); + HttpStatusCode httpStatusCode = result.block().getStatusCode(); + assertEquals(200, httpStatusCode.value()); System.out.println(body); }