Search in sources :

Example 1 with Entry

use of org.motechproject.mds.test.domain.editablelookups.Entry in project motech by motech.

the class MdsDdeBundleIT method shouldLoadLookupsFromFile.

@Test
public void shouldLoadLookupsFromFile() {
    Entry entryOne = new Entry();
    entryOne.setValue("someValue");
    entryDataService.create(entryOne);
    Entry entryTwo = new Entry();
    entryTwo.setValue("someValueTwo");
    entryDataService.create(entryTwo);
    EntityDto entity = entityService.getEntityByClassName("org.motechproject.mds.test.domain.editablelookups.Entry");
    List<LookupDto> lookups = entityService.getEntityLookups(entity.getId());
    assertEquals(1, lookups.size());
    assertEquals("Find by Value", lookups.get(0).getLookupName());
    Map<String, String> params = new HashMap<>();
    params.put("value", entryOne.getValue());
    List<Entry> lookupResult = lookupService.findMany(entity.getClassName(), lookups.get(0).getLookupName(), params);
    assertEquals(1, lookupResult.size());
    assertEquals(entryOne.getValue(), lookupResult.get(0).getValue());
}
Also used : EntityDto(org.motechproject.mds.dto.EntityDto) Entry(org.motechproject.mds.test.domain.editablelookups.Entry) HashMap(java.util.HashMap) LookupDto(org.motechproject.mds.dto.LookupDto) Test(org.junit.Test)

Aggregations

HashMap (java.util.HashMap)1 Test (org.junit.Test)1 EntityDto (org.motechproject.mds.dto.EntityDto)1 LookupDto (org.motechproject.mds.dto.LookupDto)1 Entry (org.motechproject.mds.test.domain.editablelookups.Entry)1