Search in sources :

Example 86 with Enrollment

use of org.hisp.dhis.dxf2.events.enrollment.Enrollment in project dhis2-core by dhis2.

the class TrackerRelationshipCriteriaTest method getIdentifierParamThrowsIfTrackedEntityAndEnrollmentAreSet.

@Test
void getIdentifierParamThrowsIfTrackedEntityAndEnrollmentAreSet() {
    TrackerRelationshipCriteria criteria = new TrackerRelationshipCriteria();
    criteria.setTrackedEntity("Hq3Kc6HK4OZ");
    criteria.setEnrollment("Hq3Kc6HK4OZ");
    WebMessageException exception = assertThrows(WebMessageException.class, criteria::getIdentifierParam);
    assertEquals(BAD_REQUEST.value(), exception.getWebMessage().getHttpStatusCode());
    assertEquals("Only one of parameters 'trackedEntity', 'enrollment' or 'event' is allowed.", exception.getWebMessage().getMessage());
}
Also used : WebMessageException(org.hisp.dhis.dxf2.webmessage.WebMessageException) Test(org.junit.jupiter.api.Test)

Aggregations

ImportSummary (org.hisp.dhis.dxf2.importsummary.ImportSummary)46 Enrollment (org.hisp.dhis.dxf2.events.enrollment.Enrollment)44 Test (org.junit.jupiter.api.Test)35 Event (org.hisp.dhis.dxf2.events.event.Event)31 Date (java.util.Date)28 ImportSummaries (org.hisp.dhis.dxf2.importsummary.ImportSummaries)23 TransactionalIntegrationTest (org.hisp.dhis.TransactionalIntegrationTest)20 ArrayList (java.util.ArrayList)18 ImportOptions (org.hisp.dhis.dxf2.common.ImportOptions)18 ProgramInstance (org.hisp.dhis.program.ProgramInstance)18 List (java.util.List)17 TrackedEntityInstance (org.hisp.dhis.dxf2.events.trackedentity.TrackedEntityInstance)17 TrackedEntityInstanceParams (org.hisp.dhis.dxf2.events.TrackedEntityInstanceParams)14 Program (org.hisp.dhis.program.Program)14 WebMessageException (org.hisp.dhis.dxf2.webmessage.WebMessageException)13 Map (java.util.Map)12 Set (java.util.Set)12 Collectors (java.util.stream.Collectors)12 OrganisationUnit (org.hisp.dhis.organisationunit.OrganisationUnit)12 Lists (com.google.common.collect.Lists)11