use of com.google.firestore.admin.v1.Field in project tapestry-5 by apache.
the class ValidationTrackerImplTest method newFieldWithControlName.
private final Field newFieldWithControlName(String controlName) {
Field field = mockField();
// Fields generated this way, for the purposes of this test, do not
// ever change their controlName. In real life, elementNames can change.
expect(field.getControlName()).andReturn(controlName).atLeastOnce();
return field;
}
use of com.google.firestore.admin.v1.Field in project tapestry-5 by apache.
the class ValidationTrackerImplTest method unsassoicated_errors_listed_first.
@Test
public void unsassoicated_errors_listed_first() {
ValidationTracker tracker = new ValidationTrackerImpl();
Field field = newFieldWithControlName("field");
replay();
tracker.recordError(field, "one");
tracker.recordError("two");
assertEquals(tracker.getErrors(), Arrays.asList("two", "one"));
assertEquals(tracker.getUnassociatedErrors(), Arrays.asList("two"));
verify();
}
use of com.google.firestore.admin.v1.Field in project tapestry-5 by apache.
the class EmailTest method input_mismatch.
@Test
public void input_mismatch() throws Exception {
Field field = mockField();
MessageFormatter formatter = mockMessageFormatter();
Html5Support html5Support = mockHtml5Support();
replay();
Email validator = new Email(null, html5Support);
try {
validator.validate(field, null, formatter, "invalid_email");
unreachable();
} catch (ValidationException ex) {
}
try {
validator.validate(field, null, formatter, "@mail.com");
unreachable();
} catch (ValidationException ex) {
}
// TAP5-2282
try {
validator.validate(field, null, formatter, "aaa@bbb/cc");
unreachable();
} catch (ValidationException ex) {
}
verify();
}
use of com.google.firestore.admin.v1.Field in project tapestry-5 by apache.
the class MaxLengthTest method short_enough.
@Test
public void short_enough() throws Exception {
Field field = mockField();
MessageFormatter formatter = mockMessageFormatter();
String value = "Now the student has become the master.";
replay();
MaxLength validator = new MaxLength(null);
validator.validate(field, value.length(), formatter, value);
verify();
}
use of com.google.firestore.admin.v1.Field in project tapestry-5 by apache.
the class MaxTest method small_enough.
@Test
public void small_enough() throws Exception {
Field field = mockField();
MessageFormatter formatter = mockMessageFormatter();
Long constraint = 50L;
Max validator = new Max(null, mockHtml5Support());
replay();
for (int value = 48; value <= 50; value++) validator.validate(field, constraint, formatter, value);
verify();
}
Aggregations