You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tapestry.apache.org by jk...@apache.org on 2006/06/30 04:35:18 UTC
svn commit: r418166 - in
/tapestry/tapestry4/trunk/framework/src/test/org/apache/tapestry: engine/
form/ link/ resolver/ services/impl/ valid/
Author: jkuhnert
Date: Thu Jun 29 19:35:18 2006
New Revision: 418166
URL: http://svn.apache.org/viewvc?rev=418166&view=rev
Log:
More unit test fixes. Sorry I'm not being more specific. Everything is more or less related to easymock upgrades.
Modified:
tapestry/tapestry4/trunk/framework/src/test/org/apache/tapestry/engine/RequestCycleTest.java
tapestry/tapestry4/trunk/framework/src/test/org/apache/tapestry/form/FormSupportTest.java
tapestry/tapestry4/trunk/framework/src/test/org/apache/tapestry/link/DefaultLinkRendererTest.java
tapestry/tapestry4/trunk/framework/src/test/org/apache/tapestry/resolver/AbstractSpecificationResolverTestCase.java
tapestry/tapestry4/trunk/framework/src/test/org/apache/tapestry/resolver/PageSpecificationResolverTest.java
tapestry/tapestry4/trunk/framework/src/test/org/apache/tapestry/services/impl/TestApplicationSpecificationInitializer.java
tapestry/tapestry4/trunk/framework/src/test/org/apache/tapestry/services/impl/WebContextInitializerTest.java
tapestry/tapestry4/trunk/framework/src/test/org/apache/tapestry/valid/TestPatternValidator.java
Modified: tapestry/tapestry4/trunk/framework/src/test/org/apache/tapestry/engine/RequestCycleTest.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/framework/src/test/org/apache/tapestry/engine/RequestCycleTest.java?rev=418166&r1=418165&r2=418166&view=diff
==============================================================================
--- tapestry/tapestry4/trunk/framework/src/test/org/apache/tapestry/engine/RequestCycleTest.java (original)
+++ tapestry/tapestry4/trunk/framework/src/test/org/apache/tapestry/engine/RequestCycleTest.java Thu Jun 29 19:35:18 2006
@@ -14,12 +14,13 @@
package org.apache.tapestry.engine;
+import static org.easymock.EasyMock.checkOrder;
import static org.easymock.EasyMock.expect;
-import static org.easymock.EasyMock.replay;
-import static org.easymock.EasyMock.verify;
+import static org.testng.AssertJUnit.assertEquals;
+import static org.testng.AssertJUnit.assertSame;
import org.apache.hivemind.ErrorHandler;
-import org.apache.hivemind.test.HiveMindTestCase;
+import org.apache.tapestry.BaseComponentTestCase;
import org.apache.tapestry.IEngine;
import org.apache.tapestry.IRequestCycle;
import org.apache.tapestry.RedirectException;
@@ -39,67 +40,52 @@
* @since 4.0
*/
@Test
-public class RequestCycleTest extends HiveMindTestCase
+public class RequestCycleTest extends BaseComponentTestCase
{
private IEngine newEngine()
{
- return (IEngine) newMock(IEngine.class);
+ return newMock(IEngine.class);
}
private PropertyPersistenceStrategySource newStrategySource()
{
- return (PropertyPersistenceStrategySource) newMock(PropertyPersistenceStrategySource.class);
- }
-
- private PageSource newPageSource()
- {
- return (PageSource) newMock(PageSource.class);
- }
-
- private Infrastructure newInfrastructure()
- {
- return newInfrastructure(newPageSource());
+ return newMock(PropertyPersistenceStrategySource.class);
}
private ErrorHandler newErrorHandler()
{
- return (ErrorHandler) newMock(ErrorHandler.class);
+ return newMock(ErrorHandler.class);
}
private AbsoluteURLBuilder newBuilder()
{
- return (AbsoluteURLBuilder) newMock(AbsoluteURLBuilder.class);
- }
-
- private Infrastructure newInfrastructure(PageSource source)
- {
- Infrastructure infrastructure = (Infrastructure) newMock(Infrastructure.class);
-
- expect(infrastructure.getPageSource()).andReturn(source);
-
- return infrastructure;
+ return newMock(AbsoluteURLBuilder.class);
}
private IEngineService newService()
{
- return (IEngineService) newMock(IEngineService.class);
+ return newMock(IEngineService.class);
}
public void testGetters()
{
+ Infrastructure infrastructure = newMock(Infrastructure.class);
+ PageSource pageSource = new PageSource();
+
+ expect(infrastructure.getPageSource()).andReturn(pageSource);
+
IEngineService service = newService();
ServiceMap map = newServiceMap("fred", service);
-
- Infrastructure infrastructure = newInfrastructure(newPageSource());
-
+
expect(infrastructure.getServiceMap()).andReturn(map);
RequestCycleEnvironment env = new RequestCycleEnvironment(newErrorHandler(),
infrastructure, newStrategySource(), newBuilder());
+
IEngine engine = newEngine();
-
+
replay();
-
+
IRequestCycle cycle = new RequestCycle(engine, new QueryParameterMap(), "fred", env);
assertSame(infrastructure, cycle.getInfrastructure());
@@ -111,8 +97,9 @@
private ServiceMap newServiceMap(String serviceName, IEngineService service)
{
- ServiceMap map = (ServiceMap) newMock(ServiceMap.class);
-
+ ServiceMap map = newMock(ServiceMap.class);
+ checkOrder(map, false);
+
expect(map.getService(serviceName)).andReturn(service);
return map;
@@ -120,7 +107,11 @@
public void testForgetPage()
{
- Infrastructure infrastructure = newInfrastructure();
+ Infrastructure infrastructure = newMock(Infrastructure.class);
+ PageSource pageSource = new PageSource();
+
+ expect(infrastructure.getPageSource()).andReturn(pageSource);
+
PropertyPersistenceStrategySource source = newStrategySource();
RequestCycleEnvironment env = new RequestCycleEnvironment(newErrorHandler(),
infrastructure, source, newBuilder());
Modified: tapestry/tapestry4/trunk/framework/src/test/org/apache/tapestry/form/FormSupportTest.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/framework/src/test/org/apache/tapestry/form/FormSupportTest.java?rev=418166&r1=418165&r2=418166&view=diff
==============================================================================
--- tapestry/tapestry4/trunk/framework/src/test/org/apache/tapestry/form/FormSupportTest.java (original)
+++ tapestry/tapestry4/trunk/framework/src/test/org/apache/tapestry/form/FormSupportTest.java Thu Jun 29 19:35:18 2006
@@ -14,6 +14,7 @@
package org.apache.tapestry.form;
+import static org.easymock.EasyMock.checkOrder;
import static org.easymock.EasyMock.eq;
import static org.easymock.EasyMock.expect;
import static org.easymock.EasyMock.isA;
@@ -33,6 +34,7 @@
import org.apache.tapestry.StaleLinkException;
import org.apache.tapestry.engine.ILink;
import org.apache.tapestry.event.BrowserEvent;
+import org.apache.tapestry.listener.ListenerInvoker;
import org.apache.tapestry.services.impl.ComponentEventInvoker;
import org.apache.tapestry.valid.IValidationDelegate;
import org.testng.annotations.Test;
@@ -87,7 +89,8 @@
private IFormComponent newFormComponent(String id, String name)
{
IFormComponent component = newMock(IFormComponent.class);
-
+ checkOrder(component, false);
+
trainGetId(component, id);
component.setName(name);
@@ -220,11 +223,14 @@
IRequestCycle cycle = newCycle();
IValidationDelegate delegate = newDelegate();
MockForm form = new MockForm(delegate);
- ComponentEventInvoker invoker = newMock(ComponentEventInvoker.class);
+ ListenerInvoker listenerInvoker = newMock(ListenerInvoker.class);
+
+ ComponentEventInvoker invoker = new ComponentEventInvoker();
+ invoker.setListenerInvoker(listenerInvoker);
trainIsRewound(cycle, form, true);
trainGetPageRenderSupport(cycle, null);
-
+
replay();
final FormSupport fs = new FormSupportImpl(writer, cycle, form);
@@ -232,7 +238,7 @@
verify();
delegate.clear();
-
+
trainCycleForRewind(cycle, "barney,wilma,barney_0", null);
final IFormComponent barney1 = newFormComponent("barney", "barney");
@@ -247,10 +253,10 @@
trainExtractBrowserEvent(cycle);
- invoker.invokeFormListeners(eq(fs), eq(cycle), isA(BrowserEvent.class));
-
replay();
-
+
+ invoker.invokeFormListeners(fs, cycle, new BrowserEvent(null, null));
+
assertEquals(FormConstants.SUBMIT_NORMAL, fs.rewind());
verify();
@@ -265,7 +271,7 @@
PageRenderSupport support = newPageRenderSupport();
ILink link = newLink();
IRender render = newRender();
-
+
MockForm form = new MockForm(delegate);
trainIsRewound(cycle, form, false);
@@ -276,7 +282,7 @@
final FormSupport fs = new FormSupportImpl(writer, cycle, form);
verify();
-
+
form.setBody(new IRender()
{
public void render(IMarkupWriter pwriter, IRequestCycle pcycle)
@@ -305,7 +311,10 @@
writer.attribute("name", "myform");
writer.attribute("id", "myform");
-
+
+ support.addInitializationScript("Tapestry.onsubmit('myform', function (event)"
+ + "\n{\n mySubmit1();\n mySubmit2();\n mySubmit3();\n});\n");
+
render.render(writer, cycle);
writer.println();
@@ -315,14 +324,11 @@
nested.close();
writer.end();
-
- support
- .addInitializationScript("Tapestry.onsubmit('myform', function (event)\n{\n mySubmit1();\n mySubmit2();\n mySubmit3();\n});\n");
-
+
// Side test: what if no focus field?
trainGetFocusField(delegate, null);
-
+
replay();
fs.render("post", render, link, null, null);
@@ -737,9 +743,9 @@
{ "fred" });
trainGetNestedWriter(writer, nested);
-
+
trainGetURL(link, null, "/app");
-
+
writer.begin("form");
writer.attribute("method", "post");
writer.attribute("action", "/app");
@@ -747,6 +753,9 @@
writer.attribute("name", "myform");
writer.attribute("id", "myform");
+ support.addInitializationScript("Tapestry.onreset('myform', function (event)"
+ + "\n{\n myReset1();\n myReset2();\n});\n");
+
render.render(writer, cycle);
writer.println();
@@ -757,9 +766,6 @@
writer.end();
- support
- .addInitializationScript("Tapestry.onreset('myform', function (event)\n{\n myReset1();\n myReset2();\n});\n");
-
trainGetFocusField(delegate, null);
replay();
@@ -1076,7 +1082,6 @@
IRender body = new IRender()
{
-
public void render(final IMarkupWriter pwriter, IRequestCycle pcycle)
{
fs.addDeferredRunnable(new Runnable()
@@ -1091,7 +1096,7 @@
}
};
-
+
form.setBody(body);
trainRegister(support, form, "myform");
@@ -1102,7 +1107,9 @@
{ "fred" });
trainGetNestedWriter(writer, nested);
-
+
+ nested.print("DEFERRED");
+
trainGetURL(link, null, "/app");
writer.begin("form");
@@ -1117,13 +1124,7 @@
writer.println();
trainHiddenBlock(writer, "fred", "");
-
- // EasyMock can't fully verify that this gets called at the right moment, nor can we truly
- // prove (well, except by looking at the code), that the deferred runnables execute at the
- // right time.
-
- nested.print("DEFERRED");
-
+
nested.close();
writer.end();
@@ -1153,11 +1154,11 @@
PageRenderSupport support = newPageRenderSupport();
trainGetPageRenderSupport(cycle, support);
-
+
replay();
-
+
final FormSupport fs = new FormSupportImpl(writer, cycle, form);
-
+
verify();
final IFormComponent component = newFormComponent("barney", "barney");
@@ -1271,10 +1272,10 @@
trainCycleForRewind(cycle, "", null);
- writer.print("DEFERRED");
-
trainExtractBrowserEvent(cycle);
+ writer.print("DEFERRED");
+
invoker.invokeFormListeners(eq(fs), eq(cycle), isA(BrowserEvent.class));
replay();
@@ -1326,35 +1327,38 @@
final FormSupport fs = new FormSupportImpl(writer, cycle, form);
verify();
-
- form.setBody(new IRender()
- {
- public void render(IMarkupWriter pwriter, IRequestCycle pcycle)
- {
- fs.addEventHandler(FormEventType.SUBMIT, "mySubmit()");
- }
- });
-
+
trainRegister(support, form, "myform");
-
+
trainGetParameterNames(link, new String[]
{ "service" });
trainGetParameterValues(link, "service", new String[]
{ "fred" });
-
+
trainGetNestedWriter(writer, nested);
-
+
trainGetURL(link, null, "/app");
writer.begin("form");
writer.attribute("method", "post");
writer.attribute("action", "/app");
-
+
writer.attribute("name", "myform");
writer.attribute("id", "myform");
-
+
+ form.setBody(new IRender()
+ {
+ public void render(IMarkupWriter pwriter, IRequestCycle pcycle)
+ {
+ fs.addEventHandler(FormEventType.SUBMIT, "mySubmit()");
+ }
+ });
+
+ support.addInitializationScript("Tapestry.onsubmit('myform', function (event)"
+ + "\n{\n mySubmit();\n});\n");
+
render.render(writer, cycle);
-
+
writer.println();
trainHiddenBlock(writer, "fred", "");
@@ -1363,9 +1367,6 @@
writer.end();
- support
- .addInitializationScript("Tapestry.onsubmit('myform', function (event)\n{\n mySubmit();\n});\n");
-
trainGetFocusField(delegate, null);
replay();
@@ -1459,11 +1460,6 @@
private void trainRegister(PageRenderSupport support, IForm form, String formId)
{
- /* support.addExternalScript(new ClasspathResource(getClassResolver(),
- "/org/apache/tapestry/form/Form.js"));
-
- support.addInitializationScript("Tapestry.register_form('myform');");
- */
support.addInitializationScript(form, "dojo.require(\"tapestry.form\");"
+ "tapestry.form.registerForm('" + formId + "');");
}
Modified: tapestry/tapestry4/trunk/framework/src/test/org/apache/tapestry/link/DefaultLinkRendererTest.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/framework/src/test/org/apache/tapestry/link/DefaultLinkRendererTest.java?rev=418166&r1=418165&r2=418166&view=diff
==============================================================================
--- tapestry/tapestry4/trunk/framework/src/test/org/apache/tapestry/link/DefaultLinkRendererTest.java (original)
+++ tapestry/tapestry4/trunk/framework/src/test/org/apache/tapestry/link/DefaultLinkRendererTest.java Thu Jun 29 19:35:18 2006
@@ -399,11 +399,11 @@
trainGetNestedWriter(writer, nested);
writer.print("AFTER-BODY-RENDER");
-
- writer.closeTag();
-
+
component.renderAdditionalAttributes(writer, cycle);
-
+
+ writer.closeTag();
+
cycle.removeAttribute(Tapestry.LINK_COMPONENT_ATTRIBUTE_NAME);
replay();
Modified: tapestry/tapestry4/trunk/framework/src/test/org/apache/tapestry/resolver/AbstractSpecificationResolverTestCase.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/framework/src/test/org/apache/tapestry/resolver/AbstractSpecificationResolverTestCase.java?rev=418166&r1=418165&r2=418166&view=diff
==============================================================================
--- tapestry/tapestry4/trunk/framework/src/test/org/apache/tapestry/resolver/AbstractSpecificationResolverTestCase.java (original)
+++ tapestry/tapestry4/trunk/framework/src/test/org/apache/tapestry/resolver/AbstractSpecificationResolverTestCase.java Thu Jun 29 19:35:18 2006
@@ -26,7 +26,6 @@
import org.apache.tapestry.IRequestCycle;
import org.apache.tapestry.engine.ISpecificationSource;
import org.apache.tapestry.spec.IComponentSpecification;
-import org.testng.annotations.Test;
/**
* Base class for testing specification resolvers.
@@ -34,7 +33,6 @@
* @author Howard M. Lewis Ship
* @since 4.0
*/
-@Test
public abstract class AbstractSpecificationResolverTestCase extends BaseComponentTestCase
{
Modified: tapestry/tapestry4/trunk/framework/src/test/org/apache/tapestry/resolver/PageSpecificationResolverTest.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/framework/src/test/org/apache/tapestry/resolver/PageSpecificationResolverTest.java?rev=418166&r1=418165&r2=418166&view=diff
==============================================================================
--- tapestry/tapestry4/trunk/framework/src/test/org/apache/tapestry/resolver/PageSpecificationResolverTest.java (original)
+++ tapestry/tapestry4/trunk/framework/src/test/org/apache/tapestry/resolver/PageSpecificationResolverTest.java Thu Jun 29 19:35:18 2006
@@ -14,7 +14,7 @@
package org.apache.tapestry.resolver;
-import static org.easymock.EasyMock.expect;
+import static org.easymock.EasyMock.*;
import static org.testng.AssertJUnit.assertEquals;
import static org.testng.AssertJUnit.assertSame;
@@ -162,7 +162,8 @@
private INamespace newNamespace(String pageName, IComponentSpecification spec)
{
INamespace namespace = newNamespace();
-
+ checkOrder(namespace, false);
+
trainContainsPage(namespace, pageName, spec != null);
if (spec != null)
@@ -196,7 +197,8 @@
Resource resource, IComponentSpecification pageSpec)
{
ISpecificationSource source = newSource();
-
+ checkOrder(source, false);
+
trainGetApplicationNamespace(source, application);
trainGetFrameworkNamespace(source, framework);
@@ -245,9 +247,9 @@
IComponentSpecification spec = newSpecification();
INamespace application = newNamespace();
INamespace framework = newNamespace("ExistingPage", spec);
-
+
ISpecificationSource source = newSource();
-
+
trainGetApplicationNamespace(source, application);
trainGetFrameworkNamespace(source, framework);
@@ -285,36 +287,38 @@
INamespace framework = newNamespace();
ISpecificationSource source = newSource(application, framework);
IRequestCycle cycle = newCycle();
-
- ComponentPropertySource propertySource = newPropertySource(application);
-
+
train(log, ResolverMessages.resolvingPage("TemplatePage", application));
train(log, ResolverMessages.checkingResource(contextRoot
.getRelativeResource("WEB-INF/TemplatePage.page")));
-
+
train(log, ResolverMessages.checkingResource(contextRoot
.getRelativeResource("WEB-INF/myapp/TemplatePage.page")));
train(log, ResolverMessages.checkingResource(contextRoot
.getRelativeResource("WEB-INF/TemplatePage.page")));
+
train(log, ResolverMessages.checkingResource(contextRoot
.getRelativeResource("TemplatePage.page")));
+
+ ComponentPropertySource propertySource = newPropertySource(application);
+
train(log, ResolverMessages.checkingResource(contextRoot
.getRelativeResource("TemplatePage.html")));
-
+
train(log, ResolverMessages.foundHTMLTemplate(resource));
-
+
IComponentSpecification expectedSpec = new ComponentSpecification();
expectedSpec.setPageSpecification(true);
expectedSpec.setSpecificationLocation(resource);
-
+
// The toString() on ComponentSpecification means we can't predict
// what the string would be.
-
+
trainIsDebugEnabled(log, false);
-
+
replay();
-
+
PageSpecificationResolverImpl resolver = new PageSpecificationResolverImpl();
resolver.setContextRoot(contextRoot);
resolver.setSpecificationSource(source);
@@ -410,16 +414,18 @@
Resource contextRoot = newResource("context/");
IComponentSpecification spec = newSpecification();
-
+
Resource resource = contextRoot.getRelativeResource("ContextRootPage.page");
-
+
INamespace application = newNamespace();
-
+
INamespace framework = newNamespace();
+
ISpecificationSource source = newSource(application, framework, resource, spec);
- IRequestCycle cycle = newCycle();
-
+
trainContainsPage(application, "ContextRootPage", false);
+
+ IRequestCycle cycle = newCycle();
train(log, ResolverMessages.resolvingPage("ContextRootPage", application));
@@ -468,14 +474,15 @@
Resource contextRoot = newResource("context/");
IComponentSpecification spec = newSpecification();
-
- ComponentPropertySource propertySource = newPropertySource(application);
-
+
INamespace framework = newNamespace("FrameworkPage", spec);
+
+ ComponentPropertySource propertySource = newPropertySource(application);
+
+ trainContainsPage(application, "FrameworkPage", false);
+
ISpecificationSource source = newSource(application, framework);
IRequestCycle cycle = newCycle();
-
- trainContainsPage(application, "FrameworkPage", false);
train(log, ResolverMessages.resolvingPage("FrameworkPage", application));
Modified: tapestry/tapestry4/trunk/framework/src/test/org/apache/tapestry/services/impl/TestApplicationSpecificationInitializer.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/framework/src/test/org/apache/tapestry/services/impl/TestApplicationSpecificationInitializer.java?rev=418166&r1=418165&r2=418166&view=diff
==============================================================================
--- tapestry/tapestry4/trunk/framework/src/test/org/apache/tapestry/services/impl/TestApplicationSpecificationInitializer.java (original)
+++ tapestry/tapestry4/trunk/framework/src/test/org/apache/tapestry/services/impl/TestApplicationSpecificationInitializer.java Thu Jun 29 19:35:18 2006
@@ -110,19 +110,19 @@
Log log = newLog();
i.setLog(log);
-
+
ClasspathResourceFactoryImpl cf = new ClasspathResourceFactoryImpl();
cf.setClassResolver(cr);
-
+
i.setClasspathResourceFactory(cf);
-
+
HttpServlet servlet = new ServletFixture();
ServletConfig config = newMock(ServletConfig.class);
-
+
expect(config.getInitParameter(ApplicationSpecificationInitializer.APP_SPEC_PATH_PARAM))
.andReturn(null);
-
+
expect(config.getServletContext()).andReturn(context);
expect(config.getServletName()).andReturn("fred");
Modified: tapestry/tapestry4/trunk/framework/src/test/org/apache/tapestry/services/impl/WebContextInitializerTest.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/framework/src/test/org/apache/tapestry/services/impl/WebContextInitializerTest.java?rev=418166&r1=418165&r2=418166&view=diff
==============================================================================
--- tapestry/tapestry4/trunk/framework/src/test/org/apache/tapestry/services/impl/WebContextInitializerTest.java (original)
+++ tapestry/tapestry4/trunk/framework/src/test/org/apache/tapestry/services/impl/WebContextInitializerTest.java Thu Jun 29 19:35:18 2006
@@ -18,6 +18,7 @@
import static org.testng.AssertJUnit.assertNotNull;
import static org.testng.AssertJUnit.assertSame;
+import javax.servlet.ServletConfig;
import javax.servlet.ServletContext;
import javax.servlet.http.HttpServlet;
@@ -36,24 +37,30 @@
{
public void testInitializer()
+ throws Exception
{
- HttpServlet servlet = newMock(HttpServlet.class);
+ HttpServlet servlet = new ServletFixture();
+
ServletContext servletContext = newMock(ServletContext.class);
-
- expect(servlet.getServletContext()).andReturn(servletContext);
-
+
+ ServletConfig config = newMock(ServletConfig.class);
+
+ expect(config.getServletContext()).andReturn(servletContext);
+
replay();
-
+
+ servlet.init(config);
+
ApplicationGlobals globals = new ApplicationGlobalsImpl();
-
+
WebContextInitializer initializer = new WebContextInitializer();
-
+
initializer.setGlobals(globals);
-
+
initializer.initialize(servlet);
-
+
verify();
-
+
assertSame(servletContext, globals.getServletContext());
assertNotNull(globals.getWebContext());
}
Modified: tapestry/tapestry4/trunk/framework/src/test/org/apache/tapestry/valid/TestPatternValidator.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/framework/src/test/org/apache/tapestry/valid/TestPatternValidator.java?rev=418166&r1=418165&r2=418166&view=diff
==============================================================================
--- tapestry/tapestry4/trunk/framework/src/test/org/apache/tapestry/valid/TestPatternValidator.java (original)
+++ tapestry/tapestry4/trunk/framework/src/test/org/apache/tapestry/valid/TestPatternValidator.java Thu Jun 29 19:35:18 2006
@@ -22,6 +22,7 @@
import org.apache.hivemind.ApplicationRuntimeException;
import org.apache.hivemind.Location;
import org.apache.tapestry.form.IFormComponent;
+import org.testng.annotations.Configuration;
import org.testng.annotations.Test;
/**
@@ -35,6 +36,17 @@
{
PatternValidator pv = new PatternValidator();
+ @Configuration(afterTestMethod = true)
+ public void reset()
+ {
+ pv.setClientScriptingEnabled(false);
+ pv.setPatternDelegate(null);
+ pv.setPatternNotMatchedMessage(null);
+ pv.setPatternString("");
+ pv.setRequired(false);
+ pv.setRequiredMessage(null);
+ }
+
private void positiveTest(IFormComponent field, String input) throws ValidatorException
{
Object result = pv.toObject(field, input);