public void test_Render_Contribution()
{
IMarkupWriter writer = newWriter();
IRequestCycle cycle = newCycle();
JSONObject json = new JSONObject();
FormComponentContributorContext context = newMock(FormComponentContributorContext.class);
IFormComponent field = newField("My Field", "myfield");
context.addInitializationScript(field, "dojo.require(\"dojo.i18n.number\");");
Locale locale = Locale.FRANCE;
DecimalFormatSymbols symbols = new DecimalFormatSymbols(locale);
expect(context.getLocale()).andReturn(locale).atLeastOnce();
expect(context.getProfile()).andReturn(json);
trainFormatMessage(context, null, ValidationStrings.VALUE_TOO_SMALL, new Object[]
{ "My Field", String.valueOf(new Double(20).doubleValue())}, "default message");
replay();
new Min("min=20").renderContribution(writer, cycle, context, field);
verify();
assertEquals(json.toString(),
"{\"constraints\":{\"myfield\":" +
"[[tapestry.form.validation.greaterThanOrEqual,\"20.0\",{decimal:\",\"}]]}," +
"\"myfield\":{\"constraints\":[\"default message\"]}}");
}