diff --git a/dhis-2/dhis-api/src/main/java/org/hisp/dhis/trackedentityfilter/EntityQueryCriteria.java b/dhis-2/dhis-api/src/main/java/org/hisp/dhis/trackedentityfilter/EntityQueryCriteria.java index 3a532f4d27a6..19e8bd49521f 100644 --- a/dhis-2/dhis-api/src/main/java/org/hisp/dhis/trackedentityfilter/EntityQueryCriteria.java +++ b/dhis-2/dhis-api/src/main/java/org/hisp/dhis/trackedentityfilter/EntityQueryCriteria.java @@ -56,7 +56,7 @@ public class EntityQueryCriteria implements Serializable { * Property indicating whether to filter tracked entity instances whose enrollments are marked for * followup or not */ - private Boolean followUp = false; + private Boolean followUp; /** Property indication the OU for the filter. */ private String organisationUnit; diff --git a/dhis-2/dhis-test-integration/src/test/java/org/hisp/dhis/trackedentityfilter/TrackedEntityInstanceFilterServiceTest.java b/dhis-2/dhis-test-integration/src/test/java/org/hisp/dhis/trackedentityfilter/TrackedEntityInstanceFilterServiceTest.java index 0d7bbf91aca8..b9ee33e1c247 100644 --- a/dhis-2/dhis-test-integration/src/test/java/org/hisp/dhis/trackedentityfilter/TrackedEntityInstanceFilterServiceTest.java +++ b/dhis-2/dhis-test-integration/src/test/java/org/hisp/dhis/trackedentityfilter/TrackedEntityInstanceFilterServiceTest.java @@ -95,6 +95,25 @@ void testAddGet() { assertEquals(trackedEntityInstanceFilterB, trackedEntityInstanceFilterService.get(idB)); } + @Test + void testAddFilterWithAndWithoutFollowUp() { + TrackedEntityInstanceFilter filterWithOutFollowUp = + createTrackedEntityInstanceFilter('A', programA); + TrackedEntityInstanceFilter filterWithFollowUp = + createTrackedEntityInstanceFilter('B', programB); + filterWithFollowUp.getEntityQueryCriteria().setFollowUp(true); + + long idA = trackedEntityInstanceFilterService.add(filterWithOutFollowUp); + long idB = trackedEntityInstanceFilterService.add(filterWithFollowUp); + TrackedEntityInstanceFilter fetchedA = trackedEntityInstanceFilterService.get(idA); + TrackedEntityInstanceFilter fetchedB = trackedEntityInstanceFilterService.get(idB); + + assertEquals(filterWithOutFollowUp, fetchedA); + assertNull(fetchedA.getEntityQueryCriteria().getFollowUp()); + assertEquals(filterWithFollowUp, trackedEntityInstanceFilterService.get(idB)); + assertTrue(fetchedB.getEntityQueryCriteria().getFollowUp()); + } + @Test void testDefaultPrivateAccess() { long idA =