Adding POJOs setter/getter validation tests 53/133353/1
authorwaqas.ikram <waqas.ikram@est.tech>
Mon, 20 Feb 2023 19:19:06 +0000 (19:19 +0000)
committerwaqas.ikram <waqas.ikram@est.tech>
Mon, 20 Feb 2023 19:19:15 +0000 (19:19 +0000)
Change-Id: I86f4f6fc584be350eefbc0b8cab81b5f99387cfd
Issue-ID: SO-4068
Signed-off-by: waqas.ikram <waqas.ikram@est.tech>
pom.xml
so-cnfm/so-cnfm-lcm/so-cnfm-lcm-database-service/pom.xml
so-cnfm/so-cnfm-lcm/so-cnfm-lcm-database-service/src/test/java/org/onap/so/cnfm/lcm/database/PojoClassesTests.java

diff --git a/pom.xml b/pom.xml
index e6aec53..ecd0433 100644 (file)
--- a/pom.xml
+++ b/pom.xml
@@ -25,6 +25,7 @@
         <snakeyaml-version>0.11</snakeyaml-version>
         <kubernetes-client-version>16.0.0</kubernetes-client-version>
         <kotlin-stdlib-version>1.3.70</kotlin-stdlib-version>
+        <openpojo-version>0.8.3</openpojo-version>
     </properties>
 
     <build>
index 0a94e2e..ff73b20 100644 (file)
             <version>${so-core-version}</version>
             <scope>test</scope>
         </dependency>
+        <dependency>
+            <groupId>com.openpojo</groupId>
+            <artifactId>openpojo</artifactId>
+            <version>${openpojo-version}</version>
+            <scope>test</scope>
+        </dependency>
     </dependencies>
 </project>
\ No newline at end of file
index 917e7de..9f242a1 100644 (file)
@@ -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));
+    }
+
 }