summaryrefslogtreecommitdiffstats
path: root/models-dao
diff options
context:
space:
mode:
authorwaynedunican <wayne.dunican@est.tech>2024-06-13 09:13:33 +0100
committerWayne Dunican <wayne.dunican@est.tech>2024-06-20 15:48:51 +0000
commit951a1df7e35c8aa51e91af1e17851d7d2aa45fb3 (patch)
tree59bfecd90fb46cd048becd989faf0500c446f8dc /models-dao
parent9e8684c88435734cb2e142208436cec647cde887 (diff)
Convert models to JUnit 5
Review for models-base, models-dao, models-decisions and models-errors Issue-ID: POLICY-5042 Change-Id: I0fd2252dcf5c758420508facf62d70789a5e9598 Signed-off-by: waynedunican <wayne.dunican@est.tech>
Diffstat (limited to 'models-dao')
-rw-r--r--models-dao/src/test/java/org/onap/policy/models/dao/DaoMiscTest.java18
-rw-r--r--models-dao/src/test/java/org/onap/policy/models/dao/EntityTest.java24
-rw-r--r--models-dao/src/test/java/org/onap/policy/models/dao/converters/CDataConditionerTest.java10
-rw-r--r--models-dao/src/test/java/org/onap/policy/models/dao/converters/Uuid2StringConditionerTest.java10
4 files changed, 31 insertions, 31 deletions
diff --git a/models-dao/src/test/java/org/onap/policy/models/dao/DaoMiscTest.java b/models-dao/src/test/java/org/onap/policy/models/dao/DaoMiscTest.java
index 3a46570a4..0923f348c 100644
--- a/models-dao/src/test/java/org/onap/policy/models/dao/DaoMiscTest.java
+++ b/models-dao/src/test/java/org/onap/policy/models/dao/DaoMiscTest.java
@@ -1,6 +1,6 @@
/*-
* ============LICENSE_START=======================================================
- * Copyright (C) 2019 Nordix Foundation.
+ * Copyright (C) 2019, 2024 Nordix Foundation.
* Modifications Copyright (C) 2019, 2021 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -22,31 +22,31 @@
package org.onap.policy.models.dao;
import static org.assertj.core.api.Assertions.assertThatThrownBy;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNull;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNull;
import java.util.Properties;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import org.onap.policy.models.dao.converters.CDataConditioner;
import org.onap.policy.models.dao.converters.Uuid2String;
-public class DaoMiscTest {
+class DaoMiscTest {
private static final String SOMEWHERE_OVER_THE_RAINBOW = "somewhere.over.the.rainbow";
@Test
- public void testUuid2StringMopUp() {
+ void testUuid2StringMopUp() {
final Uuid2String uuid2String = new Uuid2String();
assertEquals("", uuid2String.convertToDatabaseColumn(null));
}
@Test
- public void testCDataConditionerMopUp() {
+ void testCDataConditionerMopUp() {
assertNull(CDataConditioner.clean(null));
}
@Test
- public void testDaoFactory() {
+ void testDaoFactory() {
final DaoParameters daoParameters = new DaoParameters();
daoParameters.setPluginClass(SOMEWHERE_OVER_THE_RAINBOW);
@@ -59,7 +59,7 @@ public class DaoMiscTest {
}
@Test
- public void testDaoParameters() {
+ void testDaoParameters() {
final DaoParameters pars = new DaoParameters();
pars.setJdbcProperties(new Properties());
assertEquals(0, pars.getJdbcProperties().size());
diff --git a/models-dao/src/test/java/org/onap/policy/models/dao/EntityTest.java b/models-dao/src/test/java/org/onap/policy/models/dao/EntityTest.java
index 4f281bd68..fb2155cfd 100644
--- a/models-dao/src/test/java/org/onap/policy/models/dao/EntityTest.java
+++ b/models-dao/src/test/java/org/onap/policy/models/dao/EntityTest.java
@@ -25,9 +25,9 @@ package org.onap.policy.models.dao;
import static org.assertj.core.api.Assertions.assertThat;
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.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertNull;
import java.time.Instant;
import java.util.ArrayList;
@@ -38,8 +38,8 @@ import java.util.Properties;
import java.util.Set;
import java.util.TreeSet;
import java.util.UUID;
-import org.junit.After;
-import org.junit.Test;
+import org.junit.jupiter.api.AfterAll;
+import org.junit.jupiter.api.Test;
import org.onap.policy.models.base.PfConceptKey;
import org.onap.policy.models.base.PfModelException;
import org.onap.policy.models.base.PfReferenceKey;
@@ -50,7 +50,7 @@ import org.onap.policy.models.dao.impl.DefaultPfDao;
/**
* JUnit test class.
*/
-public class EntityTest {
+class EntityTest {
private static final String DESCRIPTION2 = "key description 2";
private static final String DESCRIPTION1 = "key description 1";
private static final String DESCRIPTION0 = "key description 0";
@@ -65,13 +65,13 @@ public class EntityTest {
private static final Instant TIMESTAMP1 = Instant.ofEpochSecond(1613494293).plusSeconds(55);
private static final Instant TIMESTAMP2 = Instant.ofEpochSecond(1613494293).plusSeconds(90);
- private PfDao pfDao;
+ private static PfDao pfDao;
/**
* Closes the DAO.
*/
- @After
- public void tearDown() {
+ @AfterAll
+ public static void tearDown() {
if (pfDao != null) {
pfDao.close();
pfDao = null;
@@ -79,7 +79,7 @@ public class EntityTest {
}
@Test
- public void testEntityTestSanity() throws PfModelException {
+ void testEntityTestSanity() throws PfModelException {
final DaoParameters daoParameters = new DaoParameters();
Properties jdbcProperties = new Properties();
@@ -110,7 +110,7 @@ public class EntityTest {
}
@Test
- public void testEntityTestAllOpsJpa() throws PfModelException {
+ void testEntityTestAllOpsJpa() throws PfModelException {
final DaoParameters daoParameters = new DaoParameters();
daoParameters.setPluginClass(DefaultPfDao.class.getName());
@@ -139,7 +139,7 @@ public class EntityTest {
}
@Test
- public void testEntityTestBadVals() throws PfModelException {
+ void testEntityTestBadVals() throws PfModelException {
final DaoParameters daoParameters = new DaoParameters();
daoParameters.setPluginClass(DefaultPfDao.class.getName());
daoParameters.setPersistenceUnit("DaoTest");
diff --git a/models-dao/src/test/java/org/onap/policy/models/dao/converters/CDataConditionerTest.java b/models-dao/src/test/java/org/onap/policy/models/dao/converters/CDataConditionerTest.java
index 60a42c299..6848c7dc3 100644
--- a/models-dao/src/test/java/org/onap/policy/models/dao/converters/CDataConditionerTest.java
+++ b/models-dao/src/test/java/org/onap/policy/models/dao/converters/CDataConditionerTest.java
@@ -1,6 +1,6 @@
/*-
* ============LICENSE_START=======================================================
- * Copyright (C) 2019 Nordix Foundation.
+ * Copyright (C) 2019, 2024 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -20,19 +20,19 @@
package org.onap.policy.models.dao.converters;
-import static org.junit.Assert.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
/**
* Test the CDataConditioner Class.
*
* @author Liam Fallon (liam.fallon@est.tech)
*/
-public class CDataConditionerTest {
+class CDataConditionerTest {
@Test
- public void testCDataConditioner() throws Exception {
+ void testCDataConditioner() throws Exception {
assertEquals("Raw", new CDataConditioner().convertToDatabaseColumn("Raw"));
assertEquals("entityAttribute", new CDataConditioner().convertToEntityAttribute("entityAttribute"));
assertEquals("marshal", new CDataConditioner().marshal("marshal"));
diff --git a/models-dao/src/test/java/org/onap/policy/models/dao/converters/Uuid2StringConditionerTest.java b/models-dao/src/test/java/org/onap/policy/models/dao/converters/Uuid2StringConditionerTest.java
index c490fdb3b..1f3694307 100644
--- a/models-dao/src/test/java/org/onap/policy/models/dao/converters/Uuid2StringConditionerTest.java
+++ b/models-dao/src/test/java/org/onap/policy/models/dao/converters/Uuid2StringConditionerTest.java
@@ -1,6 +1,6 @@
/*-
* ============LICENSE_START=======================================================
- * Copyright (C) 2019 Nordix Foundation.
+ * Copyright (C) 2019, 2024 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -20,20 +20,20 @@
package org.onap.policy.models.dao.converters;
-import static org.junit.Assert.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
import java.util.UUID;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
/**
* Test the UUID conditioner class.
*
* @author Liam Fallon (liam.fallon@est.tech)
*/
-public class Uuid2StringConditionerTest {
+class Uuid2StringConditionerTest {
@Test
- public void testUuidConditioner() throws Exception {
+ void testUuidConditioner() throws Exception {
UUID randomUuid = UUID.randomUUID();
assertEquals(randomUuid.toString(), new Uuid2String().convertToDatabaseColumn(randomUuid));
assertEquals(randomUuid, new Uuid2String().convertToEntityAttribute(randomUuid.toString()));