request.addParameter("testForm.__present", "true");
request.addParameter("testForm.myDateTime.date", "11.10.1015");
request.addParameter("testForm.myDateTime.time", "01:01");
testForm.getElement("myDateTime").setConstraint(new AfterTodayConstraint(false));
StandardServletInputData input = new StandardServletInputData(request);
input.pushScope("testForm");
testForm._getWidget().update(input);
input.popScope();
assertTrue("Test form must not be valid after reading from request", !testForm.convertAndValidate());
request = new MockHttpServletRequest();
//invalid
request.addParameter("testForm.__present", "true");
request.addParameter("testForm.myDateTime.date", sdf.format(new Date()));
request.addParameter("testForm.myDateTime.time", "00:00");
testForm.getElement("myDateTime").setConstraint(new AfterTodayConstraint(false));
input = new StandardServletInputData(request);
input.pushScope("testForm");
testForm._getWidget().update(input);
input.popScope();
assertTrue("Test form must not be valid after reading from request", !testForm.convertAndValidate());
request = new MockHttpServletRequest();
//invalid
request.addParameter("testForm.__present", "true");
request.addParameter("testForm.myDateTime.date", "11.10.2015");
request.addParameter("testForm.myDateTime.time", "01:01");
//Testing primitive constraint
testForm.getElement("myDateTime").setConstraint(new AfterTodayConstraint(true));
input = new StandardServletInputData(request);
input.pushScope("testForm");
testForm._getWidget().update(input);
input.popScope();
assertTrue("Test form must be valid after reading from request", testForm.convertAndValidate());
request = new MockHttpServletRequest();
//valid
request.addParameter("testForm.__present", "true");
request.addParameter("testForm.myDateTime.date", sdf.format(new Date()));
request.addParameter("testForm.myDateTime.time", "00:01");
//Testing primitive constraint
testForm.getElement("myDateTime").setConstraint(new AfterTodayConstraint(true));
input = new StandardServletInputData(request);
input.pushScope("testForm");
testForm._getWidget().update(input);
input.popScope();