use of org.hisp.dhis.webapi.controller.event.webrequest.TrackedEntityInstanceCriteria in project dhis2-core by dhis2.
the class TrackedEntityCriteriaMapperTest method verifyCriteriaMappingFailOnMissingProgram.
@Test
void verifyCriteriaMappingFailOnMissingProgram() {
TrackedEntityInstanceCriteria criteria = new TrackedEntityInstanceCriteria();
criteria.setProgram(programA.getUid() + 'A');
IllegalQueryException e = assertThrows(IllegalQueryException.class, () -> trackedEntityCriteriaMapper.map(criteria));
assertEquals("Program does not exist: " + programA.getUid() + "A", e.getMessage());
}
use of org.hisp.dhis.webapi.controller.event.webrequest.TrackedEntityInstanceCriteria in project dhis2-core by dhis2.
the class TrackedEntityCriteriaMapperTest method verifyCriteriaMappingFailOnMissingAttribute.
@Test
void verifyCriteriaMappingFailOnMissingAttribute() {
TrackedEntityInstanceCriteria criteria = new TrackedEntityInstanceCriteria();
criteria.setAttribute(newHashSet(attrD.getUid(), attrE.getUid(), "missing"));
IllegalQueryException e = assertThrows(IllegalQueryException.class, () -> trackedEntityCriteriaMapper.map(criteria));
assertEquals("Attribute does not exist: missing", e.getMessage());
}
use of org.hisp.dhis.webapi.controller.event.webrequest.TrackedEntityInstanceCriteria in project dhis2-core by dhis2.
the class TrackedEntityCriteriaMapperTest method testGetFromUrlFailOnNonProvidedAndAssignedUsers.
@Test
void testGetFromUrlFailOnNonProvidedAndAssignedUsers() {
TrackedEntityInstanceCriteria criteria = new TrackedEntityInstanceCriteria();
criteria.setAssignedUser(userIds);
criteria.setAssignedUserMode(AssignedUserSelectionMode.CURRENT);
IllegalQueryException e = assertThrows(IllegalQueryException.class, () -> trackedEntityCriteriaMapper.map(criteria));
assertEquals("Assigned User uid(s) cannot be specified if selectionMode is not PROVIDED", e.getMessage());
}
use of org.hisp.dhis.webapi.controller.event.webrequest.TrackedEntityInstanceCriteria in project dhis2-core by dhis2.
the class TrackedEntityCriteriaMapperTest method verifyCriteriaMappingFailOnMissingOrgUnit.
@Test
void verifyCriteriaMappingFailOnMissingOrgUnit() {
TrackedEntityInstanceCriteria criteria = new TrackedEntityInstanceCriteria();
criteria.setOu(organisationUnit.getUid() + "A");
IllegalQueryException e = assertThrows(IllegalQueryException.class, () -> trackedEntityCriteriaMapper.map(criteria));
assertEquals("Organisation unit does not exist: " + organisationUnit.getUid() + "A", e.getMessage());
}
use of org.hisp.dhis.webapi.controller.event.webrequest.TrackedEntityInstanceCriteria in project dhis2-core by dhis2.
the class TrackedEntityCriteriaMapperTest method verifyCriteriaMappingFailOnMissingFilter.
@Test
void verifyCriteriaMappingFailOnMissingFilter() {
TrackedEntityInstanceCriteria criteria = new TrackedEntityInstanceCriteria();
criteria.setFilter(newHashSet(filtF.getUid(), filtG.getUid(), "missing"));
IllegalQueryException e = assertThrows(IllegalQueryException.class, () -> trackedEntityCriteriaMapper.map(criteria));
assertEquals("Attribute does not exist: missing", e.getMessage());
}
Aggregations