use of org.apache.wicket.util.tester.FormTester in project wicket by apache.
the class DateTimeFieldTest method timeEmpty.
@Test
public void timeEmpty() {
LocalDate date = LocalDate.of(2017, 02, 13);
TestPage page = new TestPage(null);
tester.startPage(page);
FormTester formTester = tester.newFormTester("form", false);
formTester.setValue("field:date", new LocalDateConverter().convertToString(date, Locale.forLanguageTag("en-US")));
formTester.submit();
tester.assertNoErrorMessage();
assertEquals(LocalDateTime.of(date, LocalTime.of(12, 0)), page.field.getModelObject());
}
use of org.apache.wicket.util.tester.FormTester in project wicket by apache.
the class DateTimeFieldTest method dateTimeNull.
@Test
public void dateTimeNull() {
TestPage page = new TestPage(null);
tester.startPage(page);
FormTester formTester = tester.newFormTester("form", false);
formTester.submit();
tester.assertNoErrorMessage();
assertNull(page.field.getModelObject());
}
use of org.apache.wicket.util.tester.FormTester in project wicket by apache.
the class DateTimeFieldTest method dateTimeNotEmpty.
@Test
public void dateTimeNotEmpty() {
LocalDate date = LocalDate.of(2017, 02, 13);
TestPage page = new TestPage(null);
tester.startPage(page);
FormTester formTester = tester.newFormTester("form", false);
formTester.setValue("field:date", new LocalDateConverter().convertToString(date, Locale.forLanguageTag("en-US")));
formTester.setValue("field:time:hours", "6");
formTester.setValue("field:time:minutes", "15");
formTester.select("field:time:amOrPmChoice", 0);
formTester.submit();
tester.assertNoErrorMessage();
assertEquals(LocalDateTime.of(date, LocalTime.of(6, 15)), page.field.getModelObject());
}
use of org.apache.wicket.util.tester.FormTester in project wicket by apache.
the class LocalDateTextFieldTest method dateNotNullTest.
@Test
public void dateNotNullTest() {
LocalDate date = LocalDate.of(2017, 02, 13);
TestPage page = new TestPage(null);
tester.startPage(page);
FormTester formTester = tester.newFormTester("form", false);
formTester.setValue("field", new LocalDateConverter().convertToString(date, Locale.forLanguageTag("en-US")));
formTester.submit();
tester.assertNoErrorMessage();
LocalDate d = page.field.getModelObject();
assertEquals(date, d);
}
use of org.apache.wicket.util.tester.FormTester in project wicket by apache.
the class TimeFieldTest method timeNull.
@Test
public void timeNull() {
TestPage page = new TestPage(null);
tester.startPage(page);
FormTester formTester = tester.newFormTester("form", false);
formTester.submit();
tester.assertNoErrorMessage();
assertNull(page.field.getModelObject());
}
Aggregations