From d29204078930c8752d9754964ea77cdb4d9e270b Mon Sep 17 00:00:00 2001 From: luca Date: Tue, 18 Jul 2023 15:56:05 +0200 Subject: [PATCH] fix: failing enum conversion --- .../TrackedEntityInstanceAuditStoreTest.java | 26 +++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/dhis-2/dhis-test-integration/src/test/java/org/hisp/dhis/trackedentity/TrackedEntityInstanceAuditStoreTest.java b/dhis-2/dhis-test-integration/src/test/java/org/hisp/dhis/trackedentity/TrackedEntityInstanceAuditStoreTest.java index 53ada4f80792..d27309f51acb 100644 --- a/dhis-2/dhis-test-integration/src/test/java/org/hisp/dhis/trackedentity/TrackedEntityInstanceAuditStoreTest.java +++ b/dhis-2/dhis-test-integration/src/test/java/org/hisp/dhis/trackedentity/TrackedEntityInstanceAuditStoreTest.java @@ -45,6 +45,32 @@ class TrackedEntityInstanceAuditStoreTest extends SingleSetupIntegrationTestBase @Autowired private TrackedEntityInstanceAuditStore store; + private final TrackedEntityInstanceAudit teiaA = + new TrackedEntityInstanceAudit("WGW7UnVcIIb", "Access", CREATED, "userA", AuditType.CREATE); + private final TrackedEntityInstanceAudit teiaB = + new TrackedEntityInstanceAudit("WGW7UnVcIIb", "Access", CREATED, "userB", AuditType.UPDATE); + private final TrackedEntityInstanceAudit teiaC = + new TrackedEntityInstanceAudit("zIAwTY3Drrn", "Access", CREATED, "userA", AuditType.UPDATE); + private final TrackedEntityInstanceAudit teiaD = + new TrackedEntityInstanceAudit("zIAwTY3Drrn", "Access", CREATED, "userB", AuditType.DELETE); + + @Test + void shouldAuditTrackedEntity_whenAddAuditList() { + store.addTrackedEntityInstanceAudit(List.of(teiaA, teiaB, teiaC, teiaD)); + + TrackedEntityInstanceAuditQueryParams params = + new TrackedEntityInstanceAuditQueryParams() + .setTrackedEntityInstances(List.of("WGW7UnVcIIb")); + + assertContainsOnly(List.of(teiaA, teiaB), store.getTrackedEntityInstanceAudits(params)); + + params = + new TrackedEntityInstanceAuditQueryParams() + .setTrackedEntityInstances(List.of("zIAwTY3Drrn")); + + assertContainsOnly(List.of(teiaC, teiaD), store.getTrackedEntityInstanceAudits(params)); + } + @Test void testGetAuditsByParams() { TrackedEntityInstanceAudit teiaA =