Sonar Fixes policy/models, removing model-yaml
[policy/models.git] / models-dao / src / test / java / org / onap / policy / models / dao / EntityTest.java
index f5702e6..040b76b 100644 (file)
@@ -1,7 +1,7 @@
 /*-
  * ============LICENSE_START=======================================================
  *  Copyright (C) 2019-2020 Nordix Foundation.
- *  Modifications Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
+ *  Modifications Copyright (C) 2019-2020 AT&T Intellectual Property. All rights reserved.
  * ================================================================================
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
 
 package org.onap.policy.models.dao;
 
+import static org.assertj.core.api.Assertions.assertThatCode;
 import static org.assertj.core.api.Assertions.assertThatThrownBy;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertTrue;
 
 import java.util.ArrayList;
 import java.util.Date;
@@ -166,7 +166,7 @@ public class EntityTest {
         pfDao.getConcept(PfReferenceKey.class, nullRefKey);
         pfDao.size(null);
 
-        pfDao.close();
+        assertThatCode(() -> pfDao.close()).doesNotThrowAnyException();
     }
 
     private void testAllOps() {
@@ -183,13 +183,13 @@ public class EntityTest {
         pfDao.create(keyInfo0);
 
         final DummyConceptEntity keyInfoBack0 = pfDao.get(DummyConceptEntity.class, aKey0);
-        assertTrue(keyInfo0.equals(keyInfoBack0));
+        assertEquals(keyInfo0, keyInfoBack0);
 
         final DummyConceptEntity keyInfoBackNull = pfDao.get(DummyConceptEntity.class, PfConceptKey.getNullKey());
         assertNull(keyInfoBackNull);
 
         final DummyConceptEntity keyInfoBack1 = pfDao.getConcept(DummyConceptEntity.class, aKey0);
-        assertTrue(keyInfoBack0.equals(keyInfoBack1));
+        assertEquals(keyInfoBack0, keyInfoBack1);
 
         final DummyConceptEntity keyInfoBack2 =
                 pfDao.getConcept(DummyConceptEntity.class, new PfConceptKey("A-KEY3", VERSION001));
@@ -204,12 +204,12 @@ public class EntityTest {
         Set<DummyConceptEntity> keyInfoSetOut = new TreeSet<>(pfDao.getAll(DummyConceptEntity.class));
 
         keyInfoSetIn.add(keyInfo0);
-        assertTrue(keyInfoSetIn.equals(keyInfoSetOut));
+        assertEquals(keyInfoSetIn, keyInfoSetOut);
 
         pfDao.delete(keyInfo1);
         keyInfoSetIn.remove(keyInfo1);
         keyInfoSetOut = new TreeSet<>(pfDao.getAll(DummyConceptEntity.class));
-        assertTrue(keyInfoSetIn.equals(keyInfoSetOut));
+        assertEquals(keyInfoSetIn, keyInfoSetOut);
 
         pfDao.deleteCollection(keyInfoSetIn);
         keyInfoSetOut = new TreeSet<>(pfDao.getAll(DummyConceptEntity.class));
@@ -220,7 +220,7 @@ public class EntityTest {
         keyInfoSetIn.add(keyInfo0);
         pfDao.createCollection(keyInfoSetIn);
         keyInfoSetOut = new TreeSet<>(pfDao.getAll(DummyConceptEntity.class));
-        assertTrue(keyInfoSetIn.equals(keyInfoSetOut));
+        assertEquals(keyInfoSetIn, keyInfoSetOut);
 
         pfDao.delete(DummyConceptEntity.class, aKey0);
         keyInfoSetOut = new TreeSet<>(pfDao.getAll(DummyConceptEntity.class));
@@ -242,7 +242,7 @@ public class EntityTest {
         keyInfoSetIn.add(keyInfo0);
         pfDao.createCollection(keyInfoSetIn);
         keyInfoSetOut = new TreeSet<>(pfDao.getAll(DummyConceptEntity.class));
-        assertTrue(keyInfoSetIn.equals(keyInfoSetOut));
+        assertEquals(keyInfoSetIn, keyInfoSetOut);
 
         pfDao.deleteAll(DummyConceptEntity.class);
         assertEquals(0, pfDao.size(DummyConceptEntity.class));