diff --git a/junit/kubernetes-server-mock/src/test/java/io/fabric8/kubernetes/client/server/mock/crud/KubernetesCrudDispatcherPatchTest.java b/junit/kubernetes-server-mock/src/test/java/io/fabric8/kubernetes/client/server/mock/crud/KubernetesCrudDispatcherPatchTest.java index 9933708a6b5..21bd983f6f7 100644 --- a/junit/kubernetes-server-mock/src/test/java/io/fabric8/kubernetes/client/server/mock/crud/KubernetesCrudDispatcherPatchTest.java +++ b/junit/kubernetes-server-mock/src/test/java/io/fabric8/kubernetes/client/server/mock/crud/KubernetesCrudDispatcherPatchTest.java @@ -36,6 +36,7 @@ import java.util.function.UnaryOperator; import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.assertThatExceptionOfType; import static org.assertj.core.api.Assertions.assertThatThrownBy; import static org.junit.jupiter.api.Assertions.assertThrows; @@ -319,11 +320,10 @@ void differentResourceVersionConflictEdit() { .addToData("key", "changed") .build()); // Then - assertThatThrownBy(patchedCmOp::patch) - .asInstanceOf(InstanceOfAssertFactories.type(KubernetesClientException.class)) + assertThatExceptionOfType(KubernetesClientException.class) + .isThrownBy(patchedCmOp::patch) .hasFieldOrPropertyWithValue("code", 409) - .extracting(KubernetesClientException::getMessage).asString() - .contains("the object has been modified;"); + .withMessageContaining("the object has been modified;"); } @Test diff --git a/junit/mockwebserver/src/test/groovy/io/fabric8/mockwebserver/DefaultMockServerTest.groovy b/junit/mockwebserver/src/test/groovy/io/fabric8/mockwebserver/DefaultMockServerTest.groovy index 85a6d9ca769..5ff230abda4 100644 --- a/junit/mockwebserver/src/test/groovy/io/fabric8/mockwebserver/DefaultMockServerTest.groovy +++ b/junit/mockwebserver/src/test/groovy/io/fabric8/mockwebserver/DefaultMockServerTest.groovy @@ -620,7 +620,7 @@ class DefaultMockServerTest extends Specification { server.expect().get().withPath("/api/v1/users/watch") .andUpgradeToWebSocket() .open() - .immediately().andEmit("READY") + .waitFor(50L).andEmit("READY") .expectHttpRequest("/api/v1/create").andEmit("CREATED").once() .expectSentWebSocketMessage("CREATED").andEmit("WS-CREATED").once() .done() diff --git a/junit/mockwebserver/src/test/groovy/io/fabric8/mockwebserver/DefaultMockServerWebSocketTest.groovy b/junit/mockwebserver/src/test/groovy/io/fabric8/mockwebserver/DefaultMockServerWebSocketTest.groovy index ac596b9cefe..41989c6ca69 100644 --- a/junit/mockwebserver/src/test/groovy/io/fabric8/mockwebserver/DefaultMockServerWebSocketTest.groovy +++ b/junit/mockwebserver/src/test/groovy/io/fabric8/mockwebserver/DefaultMockServerWebSocketTest.groovy @@ -123,9 +123,13 @@ class DefaultMockServerWebSocketTest extends Specification { def wsReq = wsClient.webSocket().connect(server.port, server.getHostName(), "/websocket") and: "A WebSocket listener" wsReq.onComplete { ws -> - ws.result().closeHandler { _ -> - ws.result().close() + if (ws.result().isClosed()) { future.complete(ws.result().closeReason()) + } else { + ws.result().closeHandler { _ -> + ws.result().close() + future.complete(ws.result().closeReason()) + } } } and: "An instance of AsyncConditions" diff --git a/kubernetes-client-api/src/test/java/io/fabric8/kubernetes/client/http/StandardHttpClientTest.java b/kubernetes-client-api/src/test/java/io/fabric8/kubernetes/client/http/StandardHttpClientTest.java index f3664e9e9d4..feefd0a4b5c 100644 --- a/kubernetes-client-api/src/test/java/io/fabric8/kubernetes/client/http/StandardHttpClientTest.java +++ b/kubernetes-client-api/src/test/java/io/fabric8/kubernetes/client/http/StandardHttpClientTest.java @@ -41,6 +41,7 @@ import java.util.stream.Stream; import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.assertThatExceptionOfType; import static org.assertj.core.api.Assertions.assertThatThrownBy; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertTrue; @@ -231,8 +232,9 @@ void testRequestTimeout() { }); Awaitility.await().atMost(10, TimeUnit.SECONDS).until(consumeFuture::isDone); - assertThatThrownBy(consumeFuture::get) - .isInstanceOf(ExecutionException.class).hasCauseInstanceOf(TimeoutException.class); + assertThatExceptionOfType(ExecutionException.class) + .isThrownBy(consumeFuture::get) + .withCauseExactlyInstanceOf(TimeoutException.class); } @Test diff --git a/pom.xml b/pom.xml index 929306b1011..98b141e50f0 100644 --- a/pom.xml +++ b/pom.xml @@ -109,7 +109,7 @@ 5.10.1 - 3.24.2 + 3.25.0 4.2.0 22.3.3 4.11.0