917e7deb64297ddf7044ce83d004a47dcc8a432c
[so/adapters/so-cnf-adapter.git] /
1 /*-
2  * ============LICENSE_START=======================================================
3  *  Copyright (C) 2023 Nordix Foundation.
4  * ================================================================================
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  *      http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  *
17  * SPDX-License-Identifier: Apache-2.0
18  * ============LICENSE_END=========================================================
19  */
20 package org.onap.so.cnfm.lcm.database;
21
22 import javax.persistence.Entity;
23 import javax.persistence.Id;
24 import org.junit.Test;
25 import org.onap.so.cnfm.lcm.database.beans.AsDeploymentItem;
26 import org.onap.so.cnfm.lcm.database.beans.AsInst;
27 import org.onap.so.cnfm.lcm.database.beans.AsLcmOpOcc;
28 import org.onap.so.cnfm.lcm.database.beans.AsLifecycleParam;
29 import org.onap.so.cnfm.lcm.database.beans.Job;
30 import org.onap.so.cnfm.lcm.database.beans.JobStatus;
31 import nl.jqno.equalsverifier.EqualsVerifier;
32 import nl.jqno.equalsverifier.Warning;
33
34 /**
35  * @author Waqas Ikram (waqas.ikram@est.tech)
36  */
37 public class PojoClassesTests {
38
39     @Test
40     public void test_database_job_equalAndHashMethod() throws ClassNotFoundException {
41         EqualsVerifier.forClass(Job.class)
42                 .suppress(Warning.STRICT_INHERITANCE, Warning.NONFINAL_FIELDS, Warning.INHERITED_DIRECTLY_FROM_OBJECT)
43                 .withPrefabValues(JobStatus.class, new JobStatus().job(new Job()), new JobStatus().job(new Job()))
44                 .withIgnoredAnnotations(Entity.class, Id.class).verify();
45     }
46
47     @Test
48     public void test_database_jobStatus_equalAndHashMethod() throws ClassNotFoundException {
49         EqualsVerifier.forClass(JobStatus.class)
50                 .suppress(Warning.STRICT_INHERITANCE, Warning.NONFINAL_FIELDS, Warning.INHERITED_DIRECTLY_FROM_OBJECT)
51                 .withPrefabValues(Job.class, new Job(), new Job()).withIgnoredAnnotations(Entity.class, Id.class)
52                 .verify();
53     }
54
55     @Test
56     public void test_database_asInst_equalAndHashMethod() throws ClassNotFoundException {
57         EqualsVerifier.forClass(AsInst.class)
58                 .suppress(Warning.STRICT_INHERITANCE, Warning.NONFINAL_FIELDS, Warning.INHERITED_DIRECTLY_FROM_OBJECT)
59                 .withPrefabValues(AsDeploymentItem.class, new AsDeploymentItem(), new AsDeploymentItem())
60                 .withIgnoredAnnotations(Entity.class, Id.class).verify();
61     }
62
63     @Test
64     public void test_database_asdeploymentItem_equalAndHashMethod() throws ClassNotFoundException {
65         EqualsVerifier.forClass(AsDeploymentItem.class)
66                 .suppress(Warning.STRICT_INHERITANCE, Warning.NONFINAL_FIELDS, Warning.INHERITED_DIRECTLY_FROM_OBJECT)
67                 .withPrefabValues(AsInst.class, new AsInst(), new AsInst())
68                 .withPrefabValues(AsDeploymentItem.class, new AsDeploymentItem(), new AsDeploymentItem())
69                 .withIgnoredAnnotations(Entity.class, Id.class).verify();
70     }
71
72     @Test
73     public void test_database_asLcmOpOcc_equalAndHashMethod() throws ClassNotFoundException {
74         EqualsVerifier.forClass(AsLcmOpOcc.class)
75                 .suppress(Warning.STRICT_INHERITANCE, Warning.NONFINAL_FIELDS, Warning.INHERITED_DIRECTLY_FROM_OBJECT)
76                 .withPrefabValues(AsInst.class, new AsInst(), new AsInst())
77                 .withIgnoredAnnotations(Entity.class, Id.class).verify();
78     }
79
80     @Test
81     public void test_database_asLifecycleParam_equalAndHashMethod() throws ClassNotFoundException {
82         EqualsVerifier.forClass(AsLifecycleParam.class)
83                 .suppress(Warning.STRICT_INHERITANCE, Warning.NONFINAL_FIELDS, Warning.INHERITED_DIRECTLY_FROM_OBJECT)
84                 .withPrefabValues(AsDeploymentItem.class, new AsDeploymentItem(), new AsDeploymentItem())
85                 .withIgnoredAnnotations(Entity.class, Id.class).verify();
86     }
87
88 }