use of org.motechproject.mds.web.SelectData in project motech by motech.
the class EntityControllerTest method shouldReturnRecordsSortedByName.
@Test
public void shouldReturnRecordsSortedByName() throws Exception {
List<EntityDto> expected = new ArrayList<>();
expected.add(new EntityDto(9005L, "org.motechproject.appointments.api.model.Appointment", "MOTECH Appointments API", SecurityMode.EVERYONE, null));
expected.add(new EntityDto(9006L, "org.motechproject.ivr.domain.CallDetailRecord", "MOTECH IVR API", SecurityMode.EVERYONE, null));
expected.add(new EntityDto(9008L, "org.motechproject.messagecampaign.domain.campaign.Campaign", "MOTECH Message Campaign", SecurityMode.EVERYONE, null));
expected.add(new EntityDto(9001L, "org.motechproject.openmrs.ws.resource.model.Patient", "MOTECH OpenMRS Web Services", "navio", SecurityMode.EVERYONE, null));
expected.add(new EntityDto(9003L, "org.motechproject.openmrs.ws.resource.model.Patient", "MOTECH OpenMRS Web Services", "accra", SecurityMode.EVERYONE, null));
expected.add(new EntityDto(9002L, "org.motechproject.openmrs.ws.resource.model.Person", "MOTECH OpenMRS Web Services", "navio", SecurityMode.EVERYONE, null));
expected.add(new EntityDto(9004L, "org.motechproject.openmrs.ws.resource.model.Person", "MOTECH OpenMRS Web Services", "accra", SecurityMode.EVERYONE, null));
expected.add(new EntityDto(9007L, "org.motechproject.mds.entity.Voucher", SecurityMode.EVERYONE, null));
SelectResult expectedResult = new SelectResult(new SelectData(null, 1, 10), expected);
controller.perform(get("/selectEntities").param("term", "").param("page", String.valueOf(1)).param("pageLimit", String.valueOf(10))).andExpect(status().isOk()).andExpect(content().string(new ObjectMapper().writeValueAsString(expectedResult)));
}
Aggregations