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
9 * http://www.apache.org/licenses/LICENSE-2.0
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.
17 * SPDX-License-Identifier: Apache-2.0
18 * ============LICENSE_END=========================================================
20 package org.onap.so.cnfm.lcm.database;
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;
35 * @author Waqas Ikram (waqas.ikram@est.tech)
37 public class PojoClassesTests {
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();
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)
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();
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();
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();
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();