ChatServletTest fix test

This commit is contained in:
Thomas Becker 2013-06-13 17:36:29 +02:00
parent df17ef8b3a
commit 391b0ee426
2 changed files with 5 additions and 4 deletions

View File

@ -1,2 +1,2 @@
org.eclipse.jetty.util.log.class=org.eclipse.jetty.util.log.StdErrLog org.eclipse.jetty.util.log.class=org.eclipse.jetty.util.log.StdErrLog
com.acme.LEVEL=DEBUG com.acme.LEVEL=INFO

View File

@ -42,7 +42,7 @@ public class ChatServletTest
tester.setContextPath("/"); tester.setContextPath("/");
ServletHolder dispatch = tester.addServlet(ChatServlet.class, "/chat/*"); ServletHolder dispatch = tester.addServlet(ChatServlet.class, "/chat/*");
dispatch.setInitParameter("asyncTimeout","500"); dispatch.setInitParameter("asyncTimeout", "500");
tester.start(); tester.start();
} }
@ -61,8 +61,9 @@ public class ChatServletTest
@Test @Test
public void testChat() throws Exception public void testChat() throws Exception
{ {
assertResponse("user=test&message=has%20joined!", "{\"from\":\"test\",\"chat\":\"has joined!\"}"); assertResponse("user=test&join=true&message=has%20joined!", "{\"from\":\"test\",\"chat\":\"has joined!\"}");
assertResponse("user=test&message=message", ""); String response = tester.getResponses(createRequestString("user=test&message=message"));
assertThat(response.contains("{"), is(false)); // make sure we didn't get a json body
} }
@Test @Test