Revision: 798 http://jwebunit.svn.sourceforge.net/jwebunit/?rev=798&view=rev Author: henryju Date: 2009-03-02 18:46:13 +0000 (Mon, 02 Mar 2009)
Log Message: ----------- [2647451] Added JUnit test with some modifications. Modified Paths: -------------- trunk/jwebunit-htmlunit-plugin/pom.xml trunk/jwebunit-htmlunit-plugin/src/main/java/net/sourceforge/jwebunit/htmlunit/HtmlUnitTestingEngineImpl.java trunk/jwebunit-selenium-plugin/src/main/java/net/sourceforge/jwebunit/selenium/SeleniumTestingEngineImpl.java Added Paths: ----------- trunk/jwebunit-htmlunit-plugin/src/test/java/net/sourceforge/jwebunit/htmlunit/HtmlUnitTestingEngineImplTest.java Modified: trunk/jwebunit-htmlunit-plugin/pom.xml =================================================================== --- trunk/jwebunit-htmlunit-plugin/pom.xml 2009-02-28 12:48:03 UTC (rev 797) +++ trunk/jwebunit-htmlunit-plugin/pom.xml 2009-03-02 18:46:13 UTC (rev 798) @@ -34,6 +34,12 @@ <scope>test</scope> </dependency> <dependency> + <groupId>org.mockito</groupId> + <artifactId>mockito-all</artifactId> + <version>1.7</version> + <scope>test</scope> + </dependency> + <dependency> <groupId>net.sourceforge.htmlunit</groupId> <artifactId>htmlunit</artifactId> </dependency> 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 2009-02-28 12:48:03 UTC (rev 797) +++ trunk/jwebunit-htmlunit-plugin/src/main/java/net/sourceforge/jwebunit/htmlunit/HtmlUnitTestingEngineImpl.java 2009-03-02 18:46:13 UTC (rev 798) @@ -165,6 +165,21 @@ // Implementation of IJWebUnitDialog /** + * Initializes default HtmlUnit testing engine implementation. + */ + public HtmlUnitTestingEngineImpl() { + } + + /** + * Initializes HtmlUnit testing engine implementation with web client. + * + * @param client web client + */ + HtmlUnitTestingEngineImpl(WebClient client) { + this.wc = client; + } + + /** * Begin a dialog with an initial URL and test client context. * * @param initialURL absolute url at which to begin dialog. Added: trunk/jwebunit-htmlunit-plugin/src/test/java/net/sourceforge/jwebunit/htmlunit/HtmlUnitTestingEngineImplTest.java =================================================================== --- trunk/jwebunit-htmlunit-plugin/src/test/java/net/sourceforge/jwebunit/htmlunit/HtmlUnitTestingEngineImplTest.java (rev 0) +++ trunk/jwebunit-htmlunit-plugin/src/test/java/net/sourceforge/jwebunit/htmlunit/HtmlUnitTestingEngineImplTest.java 2009-03-02 18:46:13 UTC (rev 798) @@ -0,0 +1,19 @@ +package net.sourceforge.jwebunit.htmlunit; + +import junit.framework.TestCase; +import com.gargoylesoftware.htmlunit.WebClient; +import net.sourceforge.jwebunit.api.ITestingEngine; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.verify; + +public class HtmlUnitTestingEngineImplTest extends TestCase { + public void testSetThrowExceptionOnScriptErrorShouldSetSameOnUnderlyingWebClient() throws Exception { + WebClient client = mock(WebClient.class); + ITestingEngine engine = new HtmlUnitTestingEngineImpl(client); + + engine.setThrowExceptionOnScriptError(true); + + verify(client).setThrowExceptionOnScriptError(true); + } + +} Modified: trunk/jwebunit-selenium-plugin/src/main/java/net/sourceforge/jwebunit/selenium/SeleniumTestingEngineImpl.java =================================================================== --- trunk/jwebunit-selenium-plugin/src/main/java/net/sourceforge/jwebunit/selenium/SeleniumTestingEngineImpl.java 2009-02-28 12:48:03 UTC (rev 797) +++ trunk/jwebunit-selenium-plugin/src/main/java/net/sourceforge/jwebunit/selenium/SeleniumTestingEngineImpl.java 2009-03-02 18:46:13 UTC (rev 798) @@ -431,7 +431,8 @@ } public void setThrowExceptionOnScriptError(boolean value) { - throw new UnsupportedOperationException("setThrowExceptionOnScriptError"); + throw new UnsupportedOperationException(SeleniumTestingEngineImpl.class.getSimpleName() + + "#setThrowExceptionOnScriptError is not supported"); } public void setTextField(String inputName, String text) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. ------------------------------------------------------------------------------ Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA -OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise -Strategies to boost innovation and cut costs with open source participation -Receive a $600 discount off the registration fee with the source code: SFAD http://p.sf.net/sfu/XcvMzF8H _______________________________________________ JWebUnit-development mailing list JWebUnit-development@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jwebunit-development