public void test_Render_Contribution()
{
NumberTranslator translator = new NumberTranslator();
IFormComponent field = newField("Number Field", "numberField", 1);
JSONObject json = new JSONObject();
IMarkupWriter writer = newWriter();
IRequestCycle cycle = newCycle();
FormComponentContributorContext context = newMock(FormComponentContributorContext.class);
expect(context.getProfile()).andReturn(json);
trainGetLocale(context, Locale.ENGLISH);
trainBuildMessage(context, null, ValidationStrings.INVALID_NUMBER,
new Object[] { "Number Field", "#" }, "invalid number message");
replay();
translator.renderContribution(writer, cycle, context, field);
verify();
assertEquals(json.toString(),
"{\"constraints\":{\"numberField\":[[dojo.validate.isRealNumber," +
"{places:0,decimal:\".\",separator:\",\"}]]},\"numberField\":" +
"{\"constraints\":[\"invalid number message\"]}}");
}