Update of /cvsroot/httpunit/httpunit/test/com/meterware/httpunit
In directory usw-pr-cvs1:/tmp/cvs-serv6049/test/com/meterware/httpunit
Modified Files:
WebPageTest.java
Log Message:
Robert Watkins: Added check for message truncated
Index: WebPageTest.java
===================================================================
RCS file: /cvsroot/httpunit/httpunit/test/com/meterware/httpunit/WebPageTest.java,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -r1.19 -r1.20
--- WebPageTest.java 14 Nov 2001 17:28:25 -0000 1.19
+++ WebPageTest.java 17 Jun 2002 21:22:05 -0000 1.20
@@ -338,4 +338,24 @@
}
return sb.toString();
}
+
+
+ /**
+ * This test verifies that an IO exception is thrown when only a partial response is received.
+ */
+ public void testTruncatedPage() throws Exception {
+ HttpUnitOptions.setCheckContentLength( true );
+ String page = "abcdefghijklmnop";
+ defineResource( "alphabet.html", page, "text/plain" );
+ addResourceHeader( "alphabet.html", "Content-length: 26" );
+
+ WebConversation wc = new WebConversation();
+ WebRequest request = new GetMethodWebRequest( getHostPath() + "/alphabet.html" );
+ try {
+ WebResponse simplePage = wc.getResponse( request );
+ String alphabet = simplePage.getText();
+ assertEquals( "Full string", "abcdefghijklmnopqrstuvwxyz", alphabet );
+ } catch (IOException e) {
+ }
+ }
}
|