Revision: 981 http://sourceforge.net/p/jwebunit/code/981 Author: henryju Date: 2015-07-13 16:42:44 +0000 (Mon, 13 Jul 2015) Log Message: ----------- #135 Exception from setWorkingForm should indicate the requested form details
Modified Paths: -------------- trunk/jwebunit-htmlunit-plugin/src/main/java/net/sourceforge/jwebunit/htmlunit/HtmlUnitTestingEngineImpl.java trunk/src/changes/changes.xml Modified: trunk/jwebunit-htmlunit-plugin/src/main/java/net/sourceforge/jwebunit/htmlunit/HtmlUnitTestingEngineImpl.java =================================================================== --- trunk/jwebunit-htmlunit-plugin/src/main/java/net/sourceforge/jwebunit/htmlunit/HtmlUnitTestingEngineImpl.java 2015-07-13 16:33:41 UTC (rev 980) +++ trunk/jwebunit-htmlunit-plugin/src/main/java/net/sourceforge/jwebunit/htmlunit/HtmlUnitTestingEngineImpl.java 2015-07-13 16:42:44 UTC (rev 981) @@ -399,7 +399,11 @@ */ @Override public void setWorkingForm(int index) { - setWorkingForm(getForm(index)); + HtmlForm newForm = getForm(index); + if (newForm == null) { + throw new UnableToSetFormException("No form found in current page with index " + index); + } + setWorkingForm(newForm); } /** @@ -407,7 +411,11 @@ */ @Override public void setWorkingForm(String nameOrId, int index) { - setWorkingForm(getForm(nameOrId, index)); + HtmlForm newForm = getForm(nameOrId, index); + if (newForm == null) { + throw new UnableToSetFormException("No form found in current page with name or id [" + nameOrId + "] and index " + index); + } + setWorkingForm(newForm); } /** @@ -1183,9 +1191,6 @@ } private void setWorkingForm(HtmlForm newForm) { - if (newForm == null) { - throw new UnableToSetFormException("Attempted to set form to null."); - } form = newForm; } Modified: trunk/src/changes/changes.xml =================================================================== --- trunk/src/changes/changes.xml 2015-07-13 16:33:41 UTC (rev 980) +++ trunk/src/changes/changes.xml 2015-07-13 16:42:44 UTC (rev 981) @@ -31,6 +31,9 @@ </properties> <body> <release version="3.3" date="UNKNOWN" description="HtmlUnit 2.17, Java 7"> + <action type="fix" dev="henryju" issue="135" due-to="Joseph Walton"> + Exception from setWorkingForm should indicate the requested form details. + </action> <action type="fix" dev="henryju" issue="136" due-to="Randy Chang"> Setting User-Agent not work when multiple WebTesters with different User-Agent. </action> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. ------------------------------------------------------------------------------ Don't Limit Your Business. Reach for the Cloud. GigeNET's Cloud Solutions provide you with the tools and support that you need to offload your IT needs and focus on growing your business. Configured For All Businesses. Start Your Cloud Today. https://www.gigenetcloud.com/ _______________________________________________ JWebUnit-development mailing list JWebUnit-development@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jwebunit-development