From 2fc86c209b11827e04f184715e0a8a26ce3377f8 Mon Sep 17 00:00:00 2001 From: Joakim Erdfelt Date: Mon, 3 Jul 2017 12:32:02 -0700 Subject: [PATCH] Issue #1650 - testcase stability effort --- .../jetty/cdi/websocket/basicapp/BasicAppTest.java | 2 -- .../eclipse/jetty/cdi/websocket/cdiapp/CdiAppTest.java | 9 +++++---- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/jetty-cdi/cdi-websocket/src/test/java/org/eclipse/jetty/cdi/websocket/basicapp/BasicAppTest.java b/jetty-cdi/cdi-websocket/src/test/java/org/eclipse/jetty/cdi/websocket/basicapp/BasicAppTest.java index 23b701874ff..966154d0b98 100644 --- a/jetty-cdi/cdi-websocket/src/test/java/org/eclipse/jetty/cdi/websocket/basicapp/BasicAppTest.java +++ b/jetty-cdi/cdi-websocket/src/test/java/org/eclipse/jetty/cdi/websocket/basicapp/BasicAppTest.java @@ -111,9 +111,7 @@ public class BasicAppTest socket.close(StatusCode.NORMAL,"Test complete"); socket.awaitClose(5,TimeUnit.SECONDS); - assertThat("Messages received",socket.getTextMessages().size(),is(1)); String response = socket.getTextMessages().poll(5, TimeUnit.SECONDS); - assertThat("Message[0]",response,is("Hello World")); } finally diff --git a/jetty-cdi/cdi-websocket/src/test/java/org/eclipse/jetty/cdi/websocket/cdiapp/CdiAppTest.java b/jetty-cdi/cdi-websocket/src/test/java/org/eclipse/jetty/cdi/websocket/cdiapp/CdiAppTest.java index 6ec05ac498f..152ea8ea4d0 100644 --- a/jetty-cdi/cdi-websocket/src/test/java/org/eclipse/jetty/cdi/websocket/cdiapp/CdiAppTest.java +++ b/jetty-cdi/cdi-websocket/src/test/java/org/eclipse/jetty/cdi/websocket/cdiapp/CdiAppTest.java @@ -21,6 +21,7 @@ package org.eclipse.jetty.cdi.websocket.cdiapp; import static org.hamcrest.Matchers.allOf; import static org.hamcrest.Matchers.containsString; import static org.hamcrest.Matchers.is; +import static org.hamcrest.Matchers.notNullValue; import static org.junit.Assert.assertThat; import java.io.File; @@ -139,8 +140,7 @@ public class CdiAppTest socket.close(StatusCode.NORMAL,"Test complete"); socket.awaitClose(2,TimeUnit.SECONDS); - assertThat("Messages received",socket.getTextMessages().size(),is(1)); - String response = socket.getTextMessages().poll(); + String response = socket.getTextMessages().poll(5, TimeUnit.SECONDS); assertThat("Message[0]",response, allOf( @@ -170,9 +170,10 @@ public class CdiAppTest socket.close(StatusCode.NORMAL,"Test complete"); socket.awaitClose(2,TimeUnit.SECONDS); - assertThat("Messages received",socket.getTextMessages().size(),is(2)); - String response = socket.getTextMessages().poll(); + String response = socket.getTextMessages().poll(5, TimeUnit.SECONDS); assertThat("Message[0]",response,containsString("Hello there stuff")); + response = socket.getTextMessages().poll(5, TimeUnit.SECONDS); + assertThat("Message[1]",response,notNullValue()); } finally {