Search in sources :

Example 31 with FormTester

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());
}
Also used : LocalDateConverter(org.apache.wicket.util.convert.converter.LocalDateConverter) FormTester(org.apache.wicket.util.tester.FormTester) LocalDate(java.time.LocalDate) Test(org.junit.Test)

Example 32 with FormTester

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());
}
Also used : FormTester(org.apache.wicket.util.tester.FormTester) Test(org.junit.Test)

Example 33 with FormTester

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());
}
Also used : LocalDateConverter(org.apache.wicket.util.convert.converter.LocalDateConverter) FormTester(org.apache.wicket.util.tester.FormTester) LocalDate(java.time.LocalDate) Test(org.junit.Test)

Example 34 with FormTester

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);
}
Also used : LocalDateConverter(org.apache.wicket.util.convert.converter.LocalDateConverter) FormTester(org.apache.wicket.util.tester.FormTester) LocalDate(java.time.LocalDate) Test(org.junit.Test)

Example 35 with FormTester

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());
}
Also used : FormTester(org.apache.wicket.util.tester.FormTester) Test(org.junit.Test)

Aggregations

FormTester (org.apache.wicket.util.tester.FormTester)207 Test (org.junit.Test)122 Test (org.junit.jupiter.api.Test)54 Component (org.apache.wicket.Component)50 WicketTester (org.apache.wicket.util.tester.WicketTester)14 AbstractInitializedGuiIntegrationTest (com.evolveum.midpoint.web.AbstractInitializedGuiIntegrationTest)9 SpringBootTest (org.springframework.boot.test.context.SpringBootTest)9 Test (org.testng.annotations.Test)9 List (java.util.List)8 ListModel (org.apache.wicket.model.util.ListModel)7 ArrayList (java.util.ArrayList)6 File (org.apache.wicket.util.file.File)4 OrgType (com.evolveum.midpoint.xml.ns._public.common.common_3.OrgType)3 ButtonAjaxBehavior (com.googlecode.wicket.jquery.ui.widget.dialog.ButtonAjaxBehavior)3 LocalDate (java.time.LocalDate)3 Cookie (javax.servlet.http.Cookie)3 Page (org.apache.wicket.Page)3 LocalDateConverter (org.apache.wicket.util.convert.converter.LocalDateConverter)3 Ignore (org.junit.Ignore)3 RoleType (com.evolveum.midpoint.xml.ns._public.common.common_3.RoleType)2