X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=ves-nf-oam-adopter%2Fves-nf-oam-adopter-pm-sb-rest-client%2Fsrc%2Ftest%2Fjava%2Forg%2Fo%2Fran%2Foam%2Fnf%2Foam%2Fadopter%2Fpm%2Fsb%2Frest%2Fclient%2FDefaultHttpRestClientTest.java;h=8285a0b73c3a35893c8e3872a0b86b74c373b1ef;hb=HEAD;hp=f9c115a8243b3082ecc561a6d1c8be6b729e28c8;hpb=478bd59ad277738b9788b73230168bdd183bcba7;p=oam%2Fnf-oam-adopter.git diff --git a/ves-nf-oam-adopter/ves-nf-oam-adopter-pm-sb-rest-client/src/test/java/org/o/ran/oam/nf/oam/adopter/pm/sb/rest/client/DefaultHttpRestClientTest.java b/ves-nf-oam-adopter/ves-nf-oam-adopter-pm-sb-rest-client/src/test/java/org/o/ran/oam/nf/oam/adopter/pm/sb/rest/client/DefaultHttpRestClientTest.java index f9c115a..8285a0b 100644 --- a/ves-nf-oam-adopter/ves-nf-oam-adopter-pm-sb-rest-client/src/test/java/org/o/ran/oam/nf/oam/adopter/pm/sb/rest/client/DefaultHttpRestClientTest.java +++ b/ves-nf-oam-adopter/ves-nf-oam-adopter-pm-sb-rest-client/src/test/java/org/o/ran/oam/nf/oam/adopter/pm/sb/rest/client/DefaultHttpRestClientTest.java @@ -35,7 +35,7 @@ import org.springframework.test.annotation.DirtiesContext.MethodMode; @SpringBootTest(classes = {DefaultHttpRestClient.class, PmEndpointsUrlsProperties.class}) @EnableConfigurationProperties @TestMethodOrder(MethodOrderer.OrderAnnotation.class) -public class DefaultHttpRestClientTest { +class DefaultHttpRestClientTest { private static final Adapter ADAPTER = Adapter.builder().hostIpAddress("150.62.25.26").username("admin").password("secretPassword").build(); @@ -47,7 +47,7 @@ public class DefaultHttpRestClientTest { @Test @DirtiesContext(methodMode = MethodMode.BEFORE_METHOD) - public void testGetFailedToken() { + void testGetFailedToken() { final SimpleHttpResponse response = SimpleHttpResponse.create(HttpStatus.SC_UNAUTHORIZED, "error", ContentType.APPLICATION_JSON); @@ -67,7 +67,7 @@ public class DefaultHttpRestClientTest { } @Test - public void testReadFiles() throws IOException { + void testReadFiles() throws IOException { final String tokenJson = JsonUtils.readJson("/json/tokenResponse.json"); final SimpleHttpResponse response = SimpleHttpResponse.create(HttpStatus.SC_OK, tokenJson, ContentType.APPLICATION_JSON); @@ -95,7 +95,7 @@ public class DefaultHttpRestClientTest { } @Test - public void testReadFilesResponseFail() throws IOException { + void testReadFilesResponseFail() throws IOException { final String tokenJson = JsonUtils.readJson("/json/tokenResponse.json"); final SimpleHttpResponse response = SimpleHttpResponse.create(HttpStatus.SC_OK, tokenJson, ContentType.APPLICATION_JSON); @@ -123,7 +123,7 @@ public class DefaultHttpRestClientTest { } @Test - public void testGetTimeOffset() throws IOException { + void testGetTimeOffset() throws IOException { final String tokenJson = JsonUtils.readJson("/json/tokenResponse.json"); final SimpleHttpResponse response = SimpleHttpResponse.create(HttpStatus.SC_OK, tokenJson, ContentType.APPLICATION_JSON); @@ -151,7 +151,7 @@ public class DefaultHttpRestClientTest { } @Test - public void testGetTimeOffsetFail() throws IOException { + void testGetTimeOffsetFail() throws IOException { final String tokenJson = JsonUtils.readJson("/json/tokenResponse.json"); final SimpleHttpResponse response = SimpleHttpResponse.create(HttpStatus.SC_OK, tokenJson, ContentType.APPLICATION_JSON); @@ -177,4 +177,10 @@ public class DefaultHttpRestClientTest { observer.assertError(throwable -> throwable.getMessage() .equals("Get Zone offset failed for 150.62.25.26 . Empty output received")); } + + @Test + void testGetTimeOffsetFailExecutionException() { + final TestObserver observer = restClient.getTimeZone(ADAPTER).test(); + observer.assertError(throwable -> throwable.getMessage().equals("Failed to get Zone ID for 150.62.25.26")); + } } \ No newline at end of file