From febb5bdff3dcc65ebdbe2e704d4f82e955aa47f4 Mon Sep 17 00:00:00 2001 From: "waqas.ikram" Date: Mon, 20 Feb 2023 19:19:06 +0000 Subject: Adding POJOs setter/getter validation tests Change-Id: I86f4f6fc584be350eefbc0b8cab81b5f99387cfd Issue-ID: SO-4068 Signed-off-by: waqas.ikram --- pom.xml | 1 + .../so-cnfm-lcm-database-service/pom.xml | 6 ++++ .../so/cnfm/lcm/database/PojoClassesTests.java | 40 ++++++++++++++++++++++ 3 files changed, 47 insertions(+) diff --git a/pom.xml b/pom.xml index e6aec53..ecd0433 100644 --- a/pom.xml +++ b/pom.xml @@ -25,6 +25,7 @@ 0.11 16.0.0 1.3.70 + 0.8.3 diff --git a/so-cnfm/so-cnfm-lcm/so-cnfm-lcm-database-service/pom.xml b/so-cnfm/so-cnfm-lcm/so-cnfm-lcm-database-service/pom.xml index 0a94e2e..ff73b20 100644 --- a/so-cnfm/so-cnfm-lcm/so-cnfm-lcm-database-service/pom.xml +++ b/so-cnfm/so-cnfm-lcm/so-cnfm-lcm-database-service/pom.xml @@ -45,5 +45,11 @@ ${so-core-version} test + + com.openpojo + openpojo + ${openpojo-version} + test + \ No newline at end of file diff --git a/so-cnfm/so-cnfm-lcm/so-cnfm-lcm-database-service/src/test/java/org/onap/so/cnfm/lcm/database/PojoClassesTests.java b/so-cnfm/so-cnfm-lcm/so-cnfm-lcm-database-service/src/test/java/org/onap/so/cnfm/lcm/database/PojoClassesTests.java index 917e7de..9f242a1 100644 --- a/so-cnfm/so-cnfm-lcm/so-cnfm-lcm-database-service/src/test/java/org/onap/so/cnfm/lcm/database/PojoClassesTests.java +++ b/so-cnfm/so-cnfm-lcm/so-cnfm-lcm-database-service/src/test/java/org/onap/so/cnfm/lcm/database/PojoClassesTests.java @@ -28,6 +28,12 @@ import org.onap.so.cnfm.lcm.database.beans.AsLcmOpOcc; import org.onap.so.cnfm.lcm.database.beans.AsLifecycleParam; import org.onap.so.cnfm.lcm.database.beans.Job; import org.onap.so.cnfm.lcm.database.beans.JobStatus; +import org.onap.so.openpojo.rules.ToStringTester; +import com.openpojo.reflection.impl.PojoClassFactory; +import com.openpojo.validation.Validator; +import com.openpojo.validation.ValidatorBuilder; +import com.openpojo.validation.test.impl.GetterTester; +import com.openpojo.validation.test.impl.SetterTester; import nl.jqno.equalsverifier.EqualsVerifier; import nl.jqno.equalsverifier.Warning; @@ -36,6 +42,9 @@ import nl.jqno.equalsverifier.Warning; */ public class PojoClassesTests { + private static final Validator VALIDATOR = ValidatorBuilder.create().with(new SetterTester()) + .with(new GetterTester()).with(new ToStringTester()).build(); + @Test public void test_database_job_equalAndHashMethod() throws ClassNotFoundException { EqualsVerifier.forClass(Job.class) @@ -44,6 +53,11 @@ public class PojoClassesTests { .withIgnoredAnnotations(Entity.class, Id.class).verify(); } + @Test + public void test_database_job_getterSetterMethod() { + VALIDATOR.validate(PojoClassFactory.getPojoClass(Job.class)); + } + @Test public void test_database_jobStatus_equalAndHashMethod() throws ClassNotFoundException { EqualsVerifier.forClass(JobStatus.class) @@ -52,6 +66,11 @@ public class PojoClassesTests { .verify(); } + @Test + public void test_database_jobStatus_getterSetterMethod() { + VALIDATOR.validate(PojoClassFactory.getPojoClass(JobStatus.class)); + } + @Test public void test_database_asInst_equalAndHashMethod() throws ClassNotFoundException { EqualsVerifier.forClass(AsInst.class) @@ -60,6 +79,11 @@ public class PojoClassesTests { .withIgnoredAnnotations(Entity.class, Id.class).verify(); } + @Test + public void test_database_asInst_getterSetterMethod() { + VALIDATOR.validate(PojoClassFactory.getPojoClass(AsInst.class)); + } + @Test public void test_database_asdeploymentItem_equalAndHashMethod() throws ClassNotFoundException { EqualsVerifier.forClass(AsDeploymentItem.class) @@ -69,6 +93,12 @@ public class PojoClassesTests { .withIgnoredAnnotations(Entity.class, Id.class).verify(); } + @Test + public void test_database_asdeploymentItem_getterSetterMethod() { + VALIDATOR.validate(PojoClassFactory.getPojoClass(AsDeploymentItem.class)); + } + + @Test public void test_database_asLcmOpOcc_equalAndHashMethod() throws ClassNotFoundException { EqualsVerifier.forClass(AsLcmOpOcc.class) @@ -77,6 +107,11 @@ public class PojoClassesTests { .withIgnoredAnnotations(Entity.class, Id.class).verify(); } + @Test + public void test_database_asLcmOpOcc_getterSetterMethod() { + VALIDATOR.validate(PojoClassFactory.getPojoClass(AsLcmOpOcc.class)); + } + @Test public void test_database_asLifecycleParam_equalAndHashMethod() throws ClassNotFoundException { EqualsVerifier.forClass(AsLifecycleParam.class) @@ -85,4 +120,9 @@ public class PojoClassesTests { .withIgnoredAnnotations(Entity.class, Id.class).verify(); } + @Test + public void test_database_asLifecycleParam_getterSetterMethod() { + VALIDATOR.validate(PojoClassFactory.getPojoClass(AsLifecycleParam.class)); + } + } -- cgit 1.2.3-korg