X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=policy-agent%2Fsrc%2Ftest%2Fjava%2Forg%2Foransc%2Fpolicyagent%2Fclients%2FAsyncRestClientTest.java;h=884b36feaaa022b9abf1c5379ab9e2502a97a3b1;hb=ae4206bbd7437adda91fc429efef03a13da2b702;hp=79b6e8dbe7099dcdb4a7c817288da4d6c4347963;hpb=23b444705e97a325ad51ad6104b5cfd97730dce4;p=nonrtric.git diff --git a/policy-agent/src/test/java/org/oransc/policyagent/clients/AsyncRestClientTest.java b/policy-agent/src/test/java/org/oransc/policyagent/clients/AsyncRestClientTest.java index 79b6e8db..884b36fe 100644 --- a/policy-agent/src/test/java/org/oransc/policyagent/clients/AsyncRestClientTest.java +++ b/policy-agent/src/test/java/org/oransc/policyagent/clients/AsyncRestClientTest.java @@ -2,7 +2,7 @@ * ========================LICENSE_START================================= * O-RAN-SC * %% - * Copyright (C) 2019 Nordix Foundation + * Copyright (C) 2020 Nordix Foundation * %% * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -31,9 +31,9 @@ import okhttp3.mockwebserver.MockWebServer; import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Test; -import org.oransc.policyagent.clients.AsyncRestClient.AsyncRestClientException; import org.springframework.http.HttpHeaders; import org.springframework.http.MediaType; +import org.springframework.web.reactive.function.client.WebClientResponseException; import reactor.core.publisher.Mono; import reactor.test.StepVerifier; @@ -81,8 +81,8 @@ public class AsyncRestClientTest { mockWebServer.enqueue(new MockResponse().setResponseCode(ERROR_CODE)); Mono returnedMono = clientUnderTest.get(REQUEST_URL); - StepVerifier.create(returnedMono).expectErrorMatches(throwable -> throwable instanceof AsyncRestClientException) - .verify(); + StepVerifier.create(returnedMono) + .expectErrorMatches(throwable -> throwable instanceof WebClientResponseException).verify(); } @Test @@ -100,8 +100,8 @@ public class AsyncRestClientTest { mockWebServer.enqueue(new MockResponse().setResponseCode(ERROR_CODE)); Mono returnedMono = clientUnderTest.put(REQUEST_URL, TEST_JSON); - StepVerifier.create(returnedMono).expectErrorMatches(throwable -> throwable instanceof AsyncRestClientException) - .verify(); + StepVerifier.create(returnedMono) + .expectErrorMatches(throwable -> throwable instanceof WebClientResponseException).verify(); } @Test @@ -109,7 +109,7 @@ public class AsyncRestClientTest { mockWebServer.enqueue(new MockResponse().setResponseCode(SUCCESS_CODE)); Mono returnedMono = clientUnderTest.delete(REQUEST_URL); - StepVerifier.create(returnedMono).expectComplete().verify(); + StepVerifier.create(returnedMono).expectNext("").expectComplete().verify(); } @Test @@ -117,8 +117,8 @@ public class AsyncRestClientTest { mockWebServer.enqueue(new MockResponse().setResponseCode(ERROR_CODE)); Mono returnedMono = clientUnderTest.delete(REQUEST_URL); - StepVerifier.create(returnedMono).expectErrorMatches(throwable -> throwable instanceof AsyncRestClientException) - .verify(); + StepVerifier.create(returnedMono) + .expectErrorMatches(throwable -> throwable instanceof WebClientResponseException).verify(); } @Test @@ -136,8 +136,8 @@ public class AsyncRestClientTest { mockWebServer.enqueue(new MockResponse().setResponseCode(ERROR_CODE)); Mono returnedMono = clientUnderTest.post(REQUEST_URL, TEST_JSON); - StepVerifier.create(returnedMono).expectErrorMatches(throwable -> throwable instanceof AsyncRestClientException) - .verify(); + StepVerifier.create(returnedMono) + .expectErrorMatches(throwable -> throwable instanceof WebClientResponseException).verify(); } @Test @@ -155,7 +155,7 @@ public class AsyncRestClientTest { mockWebServer.enqueue(new MockResponse().setResponseCode(ERROR_CODE)); Mono returnedMono = clientUnderTest.postWithAuthHeader(REQUEST_URL, TEST_JSON, USERNAME, PASSWORD); - StepVerifier.create(returnedMono).expectErrorMatches(throwable -> throwable instanceof AsyncRestClientException) - .verify(); + StepVerifier.create(returnedMono) + .expectErrorMatches(throwable -> throwable instanceof WebClientResponseException).verify(); } }