[Httpunit-commit] CVS: httpunit/test/com/meterware/servletunit HttpServletResponseTest.java,1.7,1.8
Brought to you by:
russgold
|
From: Russell G. <rus...@us...> - 2003-02-06 02:55:36
|
Update of /cvsroot/httpunit/httpunit/test/com/meterware/servletunit In directory sc8-pr-cvs1:/tmp/cvs-serv23455/test/com/meterware/servletunit Modified Files: HttpServletResponseTest.java Log Message: Corrected status from sendRedirect Index: HttpServletResponseTest.java =================================================================== RCS file: /cvsroot/httpunit/httpunit/test/com/meterware/servletunit/HttpServletResponseTest.java,v retrieving revision 1.7 retrieving revision 1.8 diff -u -r1.7 -r1.8 --- HttpServletResponseTest.java 6 Feb 2003 01:33:11 -0000 1.7 +++ HttpServletResponseTest.java 6 Feb 2003 02:55:32 -0000 1.8 @@ -2,7 +2,7 @@ /******************************************************************************************************************** * $Id$ * -* Copyright (c) 2000, Russell Gold +* Copyright (c) 2000-2003, Russell Gold * * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated * documentation files (the "Software"), to deal in the Software without restriction, including without limitation @@ -21,8 +21,6 @@ *******************************************************************************************************************/ import java.io.*; -import java.util.Enumeration; -import java.util.Vector; import java.util.Date; import java.text.SimpleDateFormat; @@ -109,7 +107,7 @@ public void testStreamWriterAfterOutputStream() throws Exception { ServletUnitHttpResponse servletResponse = new ServletUnitHttpResponse(); servletResponse.setContentType( "text/html" ); - ServletOutputStream sos = servletResponse.getOutputStream(); + servletResponse.getOutputStream(); try { servletResponse.getWriter(); fail( "Should have thrown IllegalStateException" ); @@ -182,7 +180,15 @@ headerList = servletResponse.getHeaderFields( "list" ); assertEquals( "setHeader did not replace the list header", headerList.length, 1 ); assertEquals( "header is wrong", "monkeyboy", headerList[ 0 ] ); + } + + public void testSendRedirect() throws Exception { + ServletUnitHttpResponse servletResponse = new ServletUnitHttpResponse(); + final String location = "http://localhost/newLocation"; + servletResponse.sendRedirect( location ); + assertEquals( "Redirected Location", location, servletResponse.getHeaderField( "Location" ) ); + assertEquals( "Status", 302, servletResponse.getStatus() ); } } |