summaryrefslogtreecommitdiffstats
path: root/adapters/mso-openstack-adapters/src/test/java/org/onap
diff options
context:
space:
mode:
authorMateusz Goluchowski <mateusz.goluchowski@nokia.com>2020-05-27 14:30:34 +0200
committerMateusz Gołuchowski <mateusz.goluchowski@nokia.com>2020-05-28 08:43:42 +0200
commitfef8fc7996990a2bf1e25c10c4e4d41412e2802d (patch)
tree9559185ec0c7f59d7a2dd4a9c06b78b6f4e590d0 /adapters/mso-openstack-adapters/src/test/java/org/onap
parent6c1869316041e314007acb2f777ea89631c890b8 (diff)
Sonar fixes
Issue-ID: SO-1841 Change-Id: I96f7793e7e4d7871908f8dbbc1e4cd3a028495d5 Signed-off-by: Mateusz Goluchowski <mateusz.goluchowski@nokia.com>
Diffstat (limited to 'adapters/mso-openstack-adapters/src/test/java/org/onap')
-rw-r--r--adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tasks/audit/AbstractAuditServiceTest.java52
1 files changed, 52 insertions, 0 deletions
diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tasks/audit/AbstractAuditServiceTest.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tasks/audit/AbstractAuditServiceTest.java
new file mode 100644
index 0000000000..a93897f83e
--- /dev/null
+++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tasks/audit/AbstractAuditServiceTest.java
@@ -0,0 +1,52 @@
+package org.onap.so.adapters.tasks.audit;
+
+import org.junit.Test;
+import org.onap.so.objects.audit.AAIObjectAudit;
+import org.onap.so.objects.audit.AAIObjectAuditList;
+import java.util.Optional;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
+public class AbstractAuditServiceTest extends AbstractAuditService {
+
+ private AAIObjectAuditList getAuditListWithObjectWithExistenceStateOf(boolean existState) {
+ AAIObjectAudit auditObject = new AAIObjectAudit();
+ AAIObjectAuditList auditList = new AAIObjectAuditList();
+
+ auditObject.setDoesObjectExist(existState);
+ auditList.getAuditList().add(auditObject);
+
+ return auditList;
+ }
+
+ @Test
+ public void didCreateAuditFail_shouldReturnFalse_whenGivenEmptyAudit() {
+ assertFalse(didCreateAuditFail(Optional.empty()));
+ }
+
+ @Test
+ public void didCreateAuditFail_shouldReturnTrue_whenGivenNotExistingObject() {
+ assertTrue(didCreateAuditFail(Optional.of(getAuditListWithObjectWithExistenceStateOf(false))));
+ }
+
+ @Test
+ public void didCreateAuditFail_shouldReturnFalse_whenGivenExistingObject() {
+ assertFalse(didCreateAuditFail(Optional.of(getAuditListWithObjectWithExistenceStateOf(true))));
+ }
+
+ @Test
+ public void didDeleteAuditFail_shouldReturnFalse_whenGivenNull() {
+ assertFalse(didDeleteAuditFail(null));
+ }
+
+ @Test
+ public void didDeleteAuditFail_shouldReturnTrue_whenGivenExistingObject() {
+ assertTrue(didDeleteAuditFail(getAuditListWithObjectWithExistenceStateOf(true)));
+ }
+
+ @Test
+ public void didDeleteAuditFail_shouldReturnFalse_whenGivenNotExistingObject() {
+ assertFalse(didDeleteAuditFail(getAuditListWithObjectWithExistenceStateOf(false)));
+ }
+
+}