From 070a2b5759882d6c8533cfb18c521fda3ea522b8 Mon Sep 17 00:00:00 2001 From: Greg Wilkins Date: Tue, 20 Dec 2011 14:54:50 +1100 Subject: [PATCH] JETTY-1463 websocket D0 parser should return progress even if no fill done --- .../jetty/websocket/WebSocketParserD00Test.java | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/jetty-websocket/src/test/java/org/eclipse/jetty/websocket/WebSocketParserD00Test.java b/jetty-websocket/src/test/java/org/eclipse/jetty/websocket/WebSocketParserD00Test.java index 3f22af55c6c..7e38a9b71ff 100644 --- a/jetty-websocket/src/test/java/org/eclipse/jetty/websocket/WebSocketParserD00Test.java +++ b/jetty-websocket/src/test/java/org/eclipse/jetty/websocket/WebSocketParserD00Test.java @@ -15,6 +15,7 @@ *******************************************************************************/ package org.eclipse.jetty.websocket; +import static org.hamcrest.Matchers.greaterThan; import static org.junit.Assert.*; import java.util.ArrayList; @@ -61,7 +62,7 @@ public class WebSocketParserD00Test int filled =_parser.parseNext(); - assertEquals(13,filled); + assertThat(filled,greaterThan(0)); assertEquals("Hello World",_handler._data.get(0)); assertTrue(_parser.isBufferEmpty()); assertTrue(_parser.getBuffer()==null); @@ -79,14 +80,14 @@ public class WebSocketParserD00Test int filled =_parser.parseNext(); - assertEquals(30,filled); + assertThat(filled,greaterThan(0)); assertEquals("Hello World",_handler._data.get(0)); assertFalse(_parser.isBufferEmpty()); assertFalse(_parser.getBuffer()==null); filled =_parser.parseNext(); - assertEquals(0,filled); + assertThat(filled,greaterThan(0)); assertEquals("Hell\uFF4f W\uFF4Frld",_handler._data.get(1)); assertTrue(_parser.isBufferEmpty()); assertTrue(_parser.getBuffer()==null); @@ -101,7 +102,7 @@ public class WebSocketParserD00Test int filled =_parser.parseNext(); - assertEquals(13,filled); + assertThat(filled,greaterThan(0)); assertEquals("Hello World",_handler._data.get(0)); assertTrue(_parser.isBufferEmpty()); assertTrue(_parser.getBuffer()==null); @@ -123,15 +124,14 @@ public class WebSocketParserD00Test _in.put((byte)(data.length&0x7f)); _in.put(data); - int filled =_parser.parseNext(); - assertEquals(13+3+data.length,filled); + assertThat(filled,greaterThan(0)); assertEquals("Hello World",_handler._data.get(0)); assertFalse(_parser.isBufferEmpty()); assertFalse(_parser.getBuffer()==null); filled =_parser.parseNext(); - assertEquals(0,filled); + assertThat(filled,greaterThan(0)); String got=_handler._data.get(1); assertEquals(data.length,got.length()); assertTrue(got.startsWith("012345678901234567890123"));