edfb20afd20fd196c1e2174ec0d56d9c267faa2d
[so.git] / so-etsi-nfvo / so-etsi-nfvo-ns-lcm / so-etsi-nfvo-ns-lcm-bpmn-flows / src / test / java / org / onap / so / etsi / nfvo / ns / lcm / bpmn / flows / PojoClassesTests.java
1 /*-
2  * ============LICENSE_START=======================================================
3  *  Copyright (C) 2020 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.etsi.nfvo.ns.lcm.bpmn.flows;
21
22 import java.util.Arrays;
23 import java.util.List;
24 import org.junit.Test;
25 import org.onap.so.etsi.nfvo.ns.lcm.bpmn.flows.nsd.FileEntry;
26 import org.onap.so.etsi.nfvo.ns.lcm.bpmn.flows.nsd.NetworkServiceDescriptor;
27 import org.onap.so.etsi.nfvo.ns.lcm.bpmn.flows.nsd.ToscaMetadata;
28 import org.onap.so.etsi.nfvo.ns.lcm.bpmn.flows.nsd.VirtualNetworkFunction;
29 import org.onap.so.openpojo.rules.ToStringTester;
30 import com.openpojo.reflection.filters.FilterPackageInfo;
31 import com.openpojo.validation.Validator;
32 import com.openpojo.validation.ValidatorBuilder;
33 import com.openpojo.validation.test.impl.GetterTester;
34 import com.openpojo.validation.test.impl.SetterTester;
35 import nl.jqno.equalsverifier.EqualsVerifier;
36 import nl.jqno.equalsverifier.Warning;
37
38 /**
39  * @author Waqas Ikram (waqas.ikram@est.tech)
40  *
41  */
42 public class PojoClassesTests {
43
44     @Test
45     public void test_nsd_parser_pojo_classes() throws ClassNotFoundException {
46
47         final Validator validator = ValidatorBuilder.create().with(new SetterTester()).with(new GetterTester())
48                 .with(new ToStringTester()).build();
49         validator.validate(FileEntry.class.getPackageName(), new FilterPackageInfo());
50     }
51
52
53     @Test
54     public void test_nsd_parser_pojo_classes_equalAndHashMethod() throws ClassNotFoundException {
55         final List<Class<?>> classes = Arrays.asList(FileEntry.class, NetworkServiceDescriptor.class,
56                 ToscaMetadata.class, VirtualNetworkFunction.class);
57         for (final Class<?> clazz : classes) {
58             EqualsVerifier.forClass(clazz).suppress(Warning.STRICT_INHERITANCE, Warning.NONFINAL_FIELDS,
59                     Warning.INHERITED_DIRECTLY_FROM_OBJECT).verify();
60         }
61     }
62
63 }