summaryrefslogtreecommitdiffstats
path: root/models-pap/src/test
diff options
context:
space:
mode:
authoradheli.tavares <adheli.tavares@est.tech>2021-06-03 10:37:35 +0100
committeradheli.tavares <adheli.tavares@est.tech>2021-06-03 12:50:14 +0100
commitd72a2ab96255ccc7a9c3a3506eab5509cbcf9ac9 (patch)
treeff63a01bc3ca1bf5c8430b98ed0437c3dafec246 /models-pap/src/test
parent443f9f35fe733fdb88b51ab9c574949f5dd4c03c (diff)
Exposing the Audit provider through Models provider.
Change-Id: I4a3a28b6dbbfbad533a69cf46c545ece7e0b147e Issue-ID: POLICY-2899 Signed-off-by: adheli.tavares <adheli.tavares@est.tech>
Diffstat (limited to 'models-pap/src/test')
-rw-r--r--models-pap/src/test/java/org/onap/policy/models/pap/persistence/provider/PolicyAuditProviderTest.java20
1 files changed, 20 insertions, 0 deletions
diff --git a/models-pap/src/test/java/org/onap/policy/models/pap/persistence/provider/PolicyAuditProviderTest.java b/models-pap/src/test/java/org/onap/policy/models/pap/persistence/provider/PolicyAuditProviderTest.java
index da231dc7b..228a3fc01 100644
--- a/models-pap/src/test/java/org/onap/policy/models/pap/persistence/provider/PolicyAuditProviderTest.java
+++ b/models-pap/src/test/java/org/onap/policy/models/pap/persistence/provider/PolicyAuditProviderTest.java
@@ -23,6 +23,7 @@ package org.onap.policy.models.pap.persistence.provider;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatThrownBy;
import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertThrows;
import static org.junit.Assert.assertTrue;
@@ -217,6 +218,25 @@ public class PolicyAuditProviderTest {
}).hasMessageMatching(String.format(FIELD_IS_NULL, "auditFilter"));
}
+ @Test
+ public void testAuditFiltersIsEmpty() {
+ AuditFilter emptyFilter = AuditFilter.builder().build();
+ assertTrue(emptyFilter.isEmpty());
+
+ AuditFilter stringsEmpty =
+ AuditFilter.builder().action(AuditAction.DEPLOYMENT).fromDate(Instant.MIN).toDate(Instant.MAX).build();
+ assertFalse(stringsEmpty.isEmpty());
+
+ AuditFilter filter = AuditFilter.builder().fromDate(Instant.MIN).toDate(Instant.MAX).build();
+ assertFalse(filter.isEmpty());
+ filter = AuditFilter.builder().fromDate(Instant.MIN).build();
+ assertFalse(filter.isEmpty());
+ filter = AuditFilter.builder().toDate(Instant.MAX).build();
+ assertFalse(filter.isEmpty());
+ filter = AuditFilter.builder().name("myPolicy").toDate(Instant.MAX).build();
+ assertFalse(filter.isEmpty());
+ }
+
private List<PolicyAudit> generatePolicyAudits(Instant date, String group, ToscaConceptIdentifier policy) {
// @formatter:off
PolicyAudit deploy = PolicyAudit.builder()