use of org.apache.tapestry5.ValidationTrackerImpl in project tapestry-5 by apache.
the class ValidationTrackerImplTest method record_error_for_form.
@Test
public void record_error_for_form() {
ValidationTracker tracker = new ValidationTrackerImpl();
assertFalse(tracker.getHasErrors());
assertTrue(tracker.getErrors().isEmpty());
tracker.recordError("one");
assertEquals(tracker.getErrors(), Arrays.asList("one"));
tracker.recordError("two");
assertEquals(tracker.getErrors(), Arrays.asList("one", "two"));
}
use of org.apache.tapestry5.ValidationTrackerImpl in project tapestry-5 by apache.
the class ValidationTrackerImplTest method data_survives_serialization.
@Test
public void data_survives_serialization() throws Exception {
Field fielda = newFieldWithControlName("fieldA");
Field fieldb = newFieldWithControlName("fieldB");
Field fieldc = newFieldWithControlName("fieldC");
replay();
ValidationTracker tracker = new ValidationTrackerImpl();
tracker.recordError("one");
tracker.recordError(fieldb, "fieldb: two");
tracker.recordError("three");
tracker.recordError(fielda, "fielda: four");
ValidationTracker copy = cloneBySerialiation(tracker);
copy.recordError(fieldc, "fieldc: five");
assertEquals(copy.getErrors(), Arrays.asList("one", "three", "fieldb: two", "fielda: four", "fieldc: five"));
verify();
}
use of org.apache.tapestry5.ValidationTrackerImpl in project tapestry-5 by apache.
the class ValidationTrackerImplTest method record_input.
@Test
public void record_input() {
Field field = newFieldWithControlName("field");
replay();
ValidationTracker tracker = new ValidationTrackerImpl();
assertNull(tracker.getInput(field));
tracker.recordInput(field, "one");
assertEquals(tracker.getInput(field), "one");
tracker.recordInput(field, "two");
assertEquals(tracker.getInput(field), "two");
verify();
}
use of org.apache.tapestry5.ValidationTrackerImpl in project tapestry-5 by apache.
the class ValidationTrackerImplTest method order_added_is_maintained.
@Test
public void order_added_is_maintained() {
Field fielda = newFieldWithControlName("fieldA");
Field fieldb = newFieldWithControlName("fieldB");
replay();
ValidationTracker tracker = new ValidationTrackerImpl();
tracker.recordError("one");
tracker.recordError(fieldb, "fieldb: two");
tracker.recordError("three");
tracker.recordError(fielda, "fielda: four");
assertEquals(tracker.getErrors(), Arrays.asList("one", "three", "fieldb: two", "fielda: four"));
verify();
}
Aggregations