[Httpunit-commit] CVS: httpunit/test/com/meterware/httpunit FormSubmitTest.java,1.29,1.30
Brought to you by:
russgold
From: Russell G. <rus...@us...> - 2002-12-26 18:55:22
|
Update of /cvsroot/httpunit/httpunit/test/com/meterware/httpunit In directory sc8-pr-cvs1:/tmp/cvs-serv13421/test/com/meterware/httpunit Modified Files: FormSubmitTest.java Log Message: form controls are now treated as HTML elements Index: FormSubmitTest.java =================================================================== RCS file: /cvsroot/httpunit/httpunit/test/com/meterware/httpunit/FormSubmitTest.java,v retrieving revision 1.29 retrieving revision 1.30 diff -u -r1.29 -r1.30 --- FormSubmitTest.java 15 Nov 2002 02:53:59 -0000 1.29 +++ FormSubmitTest.java 26 Dec 2002 18:55:19 -0000 1.30 @@ -2,7 +2,7 @@ /******************************************************************************************************************** * $Id$ * -* Copyright (c) 2000-2001, Russell Gold +* Copyright (c) 2000-2002, 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 @@ -19,16 +19,8 @@ * DEALINGS IN THE SOFTWARE. * *******************************************************************************************************************/ -import java.net.URL; - -import junit.framework.Test; -import junit.framework.TestCase; import junit.framework.TestSuite; -import java.util.Enumeration; -import java.util.StringTokenizer; -import java.util.Vector; -import java.io.ByteArrayOutputStream; import java.io.IOException; import com.meterware.pseudoserver.PseudoServlet; @@ -45,7 +37,7 @@ } - public static Test suite() { + public static TestSuite suite() { return new TestSuite( FormSubmitTest.class ); } @@ -191,6 +183,8 @@ Button reset = form.getButtonWithID( "clear" ); reset.click(); assertEquals( "Value after reset", "12", form.getParameterValue( "age" ) ); + HTMLElement element = page.getElementWithID( "clear" ); + assertSame( "Reset button", reset, element ); } @@ -415,7 +409,7 @@ WebResponse page = _wc.getResponse( getHostPath() + "/Default.html" ); WebForm form = page.getForms()[0]; try { - WebRequest request = form.getRequest(); + form.getRequest(); fail( "Should not allow submit with unnamed button" ); } catch (IllegalRequestParameterException e) { } @@ -446,14 +440,14 @@ WebForm wrongForm = wrong.getForms()[0]; HttpUnitOptions.setParameterValuesValidated( true ); - WebRequest request = form.getRequest( otherForm.getSubmitButtons()[0] ); + form.getRequest( otherForm.getSubmitButtons()[0] ); HttpUnitOptions.setParameterValuesValidated( false ); - request = form.getRequest( wrongForm.getSubmitButtons()[0] ); + form.getRequest( wrongForm.getSubmitButtons()[0] ); HttpUnitOptions.setParameterValuesValidated( true ); try { - request = form.getRequest( wrongForm.getSubmitButtons()[0] ); + form.getRequest( wrongForm.getSubmitButtons()[0] ); fail( "Failed to reject illegal button" ); } catch (IllegalRequestParameterException e) { } |