[Httpunit-commit] CVS: httpunit/test/com/meterware/pseudoserver PseudoServerTest.java,1.5,1.6
Brought to you by:
russgold
|
From: Russell G. <rus...@us...> - 2002-10-22 15:12:57
|
Update of /cvsroot/httpunit/httpunit/test/com/meterware/pseudoserver
In directory usw-pr-cvs1:/tmp/cvs-serv28743/test/com/meterware/pseudoserver
Modified Files:
PseudoServerTest.java
Log Message:
Use UnknownHostException instead of HttpServerNotFoundException
Index: PseudoServerTest.java
===================================================================
RCS file: /cvsroot/httpunit/httpunit/test/com/meterware/pseudoserver/PseudoServerTest.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- PseudoServerTest.java 5 Sep 2002 19:29:55 -0000 1.5
+++ PseudoServerTest.java 22 Oct 2002 15:12:54 -0000 1.6
@@ -21,10 +21,10 @@
*******************************************************************************************************************/
import com.meterware.httpunit.*;
-import junit.framework.TestCase;
import junit.framework.TestSuite;
import java.net.HttpURLConnection;
+import java.net.UnknownHostException;
public class PseudoServerTest extends HttpUserAgentTest {
@@ -48,9 +48,9 @@
WebConversation wc = new WebConversation();
try {
- WebResponse response = wc.getResponse( "http://no.such.host" );
+ wc.getResponse( "http://no.such.host" );
fail( "Should have rejected the request" );
- } catch (HttpServerNotFoundException e) {
+ } catch (UnknownHostException e) {
}
}
@@ -59,7 +59,7 @@
WebConversation wc = new WebConversation();
WebRequest request = new GetMethodWebRequest( getHostPath() + "/nothing.htm" );
try {
- WebResponse response = wc.getResponse( request );
+ wc.getResponse( request );
fail( "Should have rejected the request" );
} catch (HttpNotFoundException e) {
assertEquals( "Response code", HttpURLConnection.HTTP_NOT_FOUND, e.getResponseCode() );
@@ -86,7 +86,7 @@
WebConversation wc = new WebConversation();
WebRequest request = new GetMethodWebRequest( getHostPath() + "/error.htm" );
try {
- WebResponse response = wc.getResponse( request );
+ wc.getResponse( request );
fail( "Should have rejected the request" );
} catch (HttpException e) {
assertEquals( "Response code", 501, e.getResponseCode() );
@@ -131,16 +131,6 @@
WebResponse response = wc.getResponse( request );
assertEquals( "requested resource", resourceValue, response.getText().trim() );
assertEquals( "content type", "text/html", response.getContentType() );
- }
-
-
- private String asBytes( String s ) {
- StringBuffer sb = new StringBuffer();
- char[] chars = s.toCharArray();
- for (int i = 0; i < chars.length; i++) {
- sb.append( Integer.toHexString( chars[i] ) ).append( " " );
- }
- return sb.toString();
}
|