/**
* Test TextField onProcess behavior.
*/
public void testOnProcess() {
MockContext context = MockContext.initContext();
MockRequest request = context.getMockRequest();
Checkbox checkbox = new Checkbox("checkbox");
assertEquals("checkbox", checkbox.getName());
request.setParameter("checkbox", "");
assertTrue(checkbox.onProcess());
assertTrue(checkbox.isValid());
assertEquals("true", checkbox.getValue());
assertEquals(Boolean.TRUE, checkbox.getValueObject());
request.setParameter("checkbox", "true");
assertTrue(checkbox.onProcess());
assertTrue(checkbox.isValid());
assertEquals("true", checkbox.getValue());
assertEquals(Boolean.TRUE, checkbox.getValueObject());
checkbox.setRequired(true);
request.removeParameter("checkbox");
assertTrue(checkbox.onProcess());
assertFalse(checkbox.isValid());
assertEquals("false", checkbox.getValue());
assertEquals(Boolean.FALSE, checkbox.getValueObject());
assertTrue(checkbox.toString().contains("class=\"error\""));
request.setParameter("checkbox", "true");
assertTrue(checkbox.onProcess());
assertTrue(checkbox.isValid());
assertEquals("true", checkbox.getValue());
assertEquals(Boolean.TRUE, checkbox.getValueObject());
request.setParameter("checkbox", "true");
checkbox.setDisabled(true);
assertTrue(checkbox.onProcess());
assertTrue(checkbox.isValid());
assertFalse(checkbox.isDisabled());