IMarkupWriter writer = newWriter();
IRequestCycle cycle = newCycle();
MockControl contextc = newControl(FormComponentContributorContext.class);
FormComponentContributorContext context = (FormComponentContributorContext) contextc
.getMock();
context.includeClasspathScript("/org/apache/tapestry/form/validator/RegExValidator.js");
IFormComponent field = newField("Fred", "myfield");
trainFormatMessage(contextc, context, null, ValidationStrings.INVALID_EMAIL, new Object[]
{ "Fred" }, "default\\message");
context.addSubmitHandler("function(event) { Tapestry.validate_regex(event, 'myfield', '"
+ pattern + "', 'default\\\\message'); }");
replayControls();
new Email().renderContribution(writer, cycle, context, field);