[Httpunit-commit] CVS: httpunit/test/com/meterware/httpunit FormSubmitTest.java,1.33,1.34
Brought to you by:
russgold
|
From: Russell G. <rus...@us...> - 2004-09-28 09:52:41
|
Update of /cvsroot/httpunit/httpunit/test/com/meterware/httpunit In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28474/test/com/meterware/httpunit Modified Files: FormSubmitTest.java Log Message: bug #1032440: An explanatory exception is now thrown on an attempt to use a mailto: URL in a form submission Index: FormSubmitTest.java =================================================================== RCS file: /cvsroot/httpunit/httpunit/test/com/meterware/httpunit/FormSubmitTest.java,v retrieving revision 1.33 retrieving revision 1.34 diff -u -r1.33 -r1.34 --- FormSubmitTest.java 9 Aug 2004 22:13:52 -0000 1.33 +++ FormSubmitTest.java 28 Sep 2004 09:52:25 -0000 1.34 @@ -2,7 +2,7 @@ /******************************************************************************************************************** * $Id$ * -* Copyright (c) 2000-2002, Russell Gold +* Copyright (c) 2000-2004, 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 @@ -25,6 +25,7 @@ import com.meterware.pseudoserver.PseudoServlet; import com.meterware.pseudoserver.WebResource; +import org.xml.sax.SAXException; /** @@ -539,6 +540,25 @@ } + public void testMailtoActionRejected() throws Exception { + defineWebPage( "abc/form", "<form name='test' action='mailto:rus...@ht...'>" + + " <input type='text' name='text_field'>" + + " <input type='submit' name='apply' value='Apply'>" + + "</form>" ); + + WebResponse wr = _wc.getResponse( getHostPath() + "/abc/form.html" ); + WebForm form = wr.getForms()[0]; + form.setParameter( "text_field", "a value" ); + + try { + form.submit(); + fail( "Should have thrown an UnsupportedActionException" ); + } catch (UnsupportedActionException success) { + assertTrue( "Did not include mention of bad URL type", success.getMessage().indexOf( "mailto" ) >= 0 ); + } + } + + //---------------------------------------------- private members ------------------------------------------------ |