Search in sources :

Example 1 with Field

use of uk.ac.bbsrc.tgac.miso.webapp.integrationtest.page.WorksetPage.Field in project miso-lims by miso-lims.

the class WorksetPageIT method testCreate.

@Test
public void testCreate() {
    WorksetPage page = getWorksetPage(null);
    Map<Field, String> fields = new HashMap<>();
    fields.put(Field.ALIAS, "Test Set");
    fields.put(Field.DESCRIPTION, "Test description");
    page.setFields(fields);
    assertEquals("", page.getField(Field.ID));
    assertFieldValues("changes pre-save", fields, page);
    WorksetPage savedPage = page.clickSave();
    assertNotNull("Workset should save successfully", savedPage);
    assertFieldValues("changes post-save", fields, savedPage);
    Workset workset = (Workset) getSession().get(Workset.class, Long.valueOf(savedPage.getField(Field.ID)));
    assertEquals(fields.get(Field.ALIAS), workset.getAlias());
    assertEquals(fields.get(Field.DESCRIPTION), workset.getDescription());
}
Also used : Field(uk.ac.bbsrc.tgac.miso.webapp.integrationtest.page.WorksetPage.Field) Workset(uk.ac.bbsrc.tgac.miso.core.data.impl.workset.Workset) HashMap(java.util.HashMap) WorksetPage(uk.ac.bbsrc.tgac.miso.webapp.integrationtest.page.WorksetPage) Test(org.junit.Test)

Example 2 with Field

use of uk.ac.bbsrc.tgac.miso.webapp.integrationtest.page.WorksetPage.Field in project miso-lims by miso-lims.

the class WorksetPageIT method testEdit.

@Test
public void testEdit() {
    WorksetPage page = getWorksetPage(1L);
    Map<Field, String> fields = getWorksetOneFields();
    Map<Field, String> changes = new HashMap<>();
    changes.put(Field.ALIAS, "New Alias");
    changes.put(Field.DESCRIPTION, "New Desc");
    page.setFields(changes);
    fields.putAll(changes);
    assertFieldValues("changes pre-save", fields, page);
    WorksetPage savedPage = page.clickSave();
    assertNotNull("Workset should save successfully", savedPage);
    assertFieldValues("changes post-save", fields, savedPage);
    Workset workset = (Workset) getSession().get(Workset.class, Long.valueOf(savedPage.getField(Field.ID)));
    assertEquals(fields.get(Field.ALIAS), workset.getAlias());
    assertEquals(fields.get(Field.DESCRIPTION), workset.getDescription());
}
Also used : Field(uk.ac.bbsrc.tgac.miso.webapp.integrationtest.page.WorksetPage.Field) Workset(uk.ac.bbsrc.tgac.miso.core.data.impl.workset.Workset) HashMap(java.util.HashMap) WorksetPage(uk.ac.bbsrc.tgac.miso.webapp.integrationtest.page.WorksetPage) Test(org.junit.Test)

Example 3 with Field

use of uk.ac.bbsrc.tgac.miso.webapp.integrationtest.page.WorksetPage.Field in project miso-lims by miso-lims.

the class WorksetPageIT method testNullifyFields.

@Test
public void testNullifyFields() {
    WorksetPage page = getWorksetPage(1L);
    Map<Field, String> fields = getWorksetOneFields();
    assertFieldValues("original", fields, page);
    page.setField(Field.DESCRIPTION, null);
    fields.put(Field.DESCRIPTION, null);
    assertFieldValues("changes pre-save", fields, page);
    WorksetPage savedPage = page.clickSave();
    assertNotNull("Workset should save successfully", savedPage);
    assertFieldValues("changes post-save", fields, savedPage);
    Workset workset = (Workset) getSession().get(Workset.class, 1L);
    assertTrue(LimsUtils.isStringEmptyOrNull(workset.getDescription()));
}
Also used : Field(uk.ac.bbsrc.tgac.miso.webapp.integrationtest.page.WorksetPage.Field) Workset(uk.ac.bbsrc.tgac.miso.core.data.impl.workset.Workset) WorksetPage(uk.ac.bbsrc.tgac.miso.webapp.integrationtest.page.WorksetPage) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)3 Workset (uk.ac.bbsrc.tgac.miso.core.data.impl.workset.Workset)3 WorksetPage (uk.ac.bbsrc.tgac.miso.webapp.integrationtest.page.WorksetPage)3 Field (uk.ac.bbsrc.tgac.miso.webapp.integrationtest.page.WorksetPage.Field)3 HashMap (java.util.HashMap)2