[Httpunit-commit] CVS: httpunit/test/com/meterware/servletunit HttpServletRequestTest.java,1.12,1.13
Brought to you by:
russgold
|
From: Russell G. <rus...@us...> - 2003-02-13 15:37:11
|
Update of /cvsroot/httpunit/httpunit/test/com/meterware/servletunit
In directory sc8-pr-cvs1:/tmp/cvs-serv18094/test/com/meterware/servletunit
Modified Files:
HttpServletRequestTest.java
Log Message:
setAttribute now permits multiple calls with the same value
Index: HttpServletRequestTest.java
===================================================================
RCS file: /cvsroot/httpunit/httpunit/test/com/meterware/servletunit/HttpServletRequestTest.java,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- HttpServletRequestTest.java 6 Feb 2003 01:33:11 -0000 1.12
+++ HttpServletRequestTest.java 13 Feb 2003 15:37:01 -0000 1.13
@@ -188,15 +188,21 @@
public void testDuplicateAttributes() throws Exception {
WebRequest wr = new GetMethodWebRequest( "http://localhost/simple" );
HttpServletRequest request = new ServletUnitHttpRequest( NULL_SERVLET_REQUEST, wr, new ServletUnitContext(), new Hashtable(), NO_MESSAGE_BODY );
- Object value = new Integer(1);
- request.setAttribute( "one", value );
+ request.setAttribute( "one", new Integer(1) );
+ request.setAttribute( "one", "One" );
+ assertEquals( "Revised attribute value", "One", request.getAttribute( "one" ) );
+ }
- try {
- request.setAttribute( "one", value );
- fail( "Did not complain about illegal state" );
- } catch (IllegalStateException e) {
- }
+
+ public void testNullAttributeValue() throws Exception {
+ WebRequest wr = new GetMethodWebRequest( "http://localhost/simple" );
+ HttpServletRequest request = new ServletUnitHttpRequest( NULL_SERVLET_REQUEST, wr, new ServletUnitContext(), new Hashtable(), NO_MESSAGE_BODY );
+
+ request.setAttribute( "one", "One" );
+ assertEquals( "Initial attribute value", "One", request.getAttribute( "one" ) );
+ request.setAttribute( "one", null );
+ assertNull( "Attribute 'one' should have been removed", request.getAttribute( "one" ) );
}
|