use of org.apache.tapestry5.services.Html5Support 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 org.apache.tapestry5.services.Html5Support in project tapestry-5 by apache.
the class RequiredTest method blank_value.
@Test
public void blank_value() {
MessageFormatter formatter = mockMessageFormatter();
Field field = mockFieldWithLabel("My Field");
train_format(formatter, "{message}", "My Field");
Html5Support html5Support = mockHtml5Support();
replay();
try {
new Required(null, html5Support).validate(field, null, formatter, "");
unreachable();
} catch (ValidationException ex) {
assertEquals(ex.getMessage(), "{message}");
}
verify();
}
use of org.apache.tapestry5.services.Html5Support in project tapestry-5 by apache.
the class RequiredTest method empty_collection_value.
@Test
public void empty_collection_value() {
MessageFormatter formatter = mockMessageFormatter();
Field field = mockFieldWithLabel("My Field");
train_format(formatter, "{message}", "My Field");
Html5Support html5Support = mockHtml5Support();
replay();
try {
new Required(null, html5Support).validate(field, null, formatter, Arrays.asList());
unreachable();
} catch (ValidationException ex) {
assertEquals(ex.getMessage(), "{message}");
}
verify();
}
use of org.apache.tapestry5.services.Html5Support in project tapestry-5 by apache.
the class RequiredTest method non_blank_value.
@Test
public void non_blank_value() throws Exception {
MessageFormatter formatter = mockMessageFormatter();
Field field = mockField();
Html5Support html5Support = mockHtml5Support();
replay();
new Required(null, html5Support).validate(field, null, formatter, "not null");
verify();
}
use of org.apache.tapestry5.services.Html5Support in project tapestry-5 by apache.
the class RequiredTest method not_empty_collection_value.
@Test
public void not_empty_collection_value() throws Exception {
MessageFormatter formatter = mockMessageFormatter();
Field field = mockField();
Html5Support html5Support = mockHtml5Support();
replay();
new Required(null, html5Support).validate(field, null, formatter, Arrays.asList("A", "B"));
verify();
}
Aggregations