Convert models to JUnit 5
[policy/models.git] / models-sim / policy-models-sim-pdp / src / test / java / org / onap / policy / models / sim / pdp / parameters / TestPdpStatusParameters.java
1 /*-
2  * ============LICENSE_START=======================================================
3  *  Copyright (C) 2019 Nordix Foundation.
4  *  Modifications Copyright (C) 2019, 2021 AT&T Intellectual Property. All rights reserved.
5  *  Modifications Copyright (C) 2024 Nordix Foundation
6  * ================================================================================
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  *
11  *      http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  *
19  * SPDX-License-Identifier: Apache-2.0
20  * ============LICENSE_END=========================================================
21  */
22
23 package org.onap.policy.models.sim.pdp.parameters;
24
25 import static org.junit.jupiter.api.Assertions.assertEquals;
26 import static org.junit.jupiter.api.Assertions.assertNull;
27 import static org.junit.jupiter.api.Assertions.assertTrue;
28
29 import org.junit.jupiter.api.Test;
30 import org.onap.policy.common.parameters.ValidationResult;
31
32 /**
33  * Class to perform unit test of {@link PdpStatusParameters}.
34  *
35  * @author Ajith Sreekumar (ajith.sreekumar@est.tech)
36  */
37 class TestPdpStatusParameters {
38     private static CommonTestData testData = new CommonTestData();
39
40     @Test
41     void test() {
42         final PdpStatusParameters pdpStatusParameters =
43                 testData.toObject(testData.getPdpStatusParametersMap(false), PdpStatusParameters.class);
44         final ValidationResult validationResult = pdpStatusParameters.validate();
45         assertTrue(validationResult.isValid());
46         assertEquals(CommonTestData.TIME_INTERVAL, pdpStatusParameters.getTimeIntervalMs());
47         assertEquals(CommonTestData.PDP_TYPE, pdpStatusParameters.getPdpType());
48         assertEquals(CommonTestData.DESCRIPTION, pdpStatusParameters.getDescription());
49         assertEquals(CommonTestData.SUPPORTED_POLICY_TYPES, pdpStatusParameters.getSupportedPolicyTypes());
50         assertEquals(CommonTestData.PDP_GROUP, pdpStatusParameters.getPdpGroup());
51     }
52
53     @Test
54     void testValidate() {
55         final PdpStatusParameters pdpStatusParameters =
56                 testData.toObject(testData.getPdpStatusParametersMap(false), PdpStatusParameters.class);
57         final ValidationResult result = pdpStatusParameters.validate();
58         assertNull(result.getResult());
59         assertTrue(result.isValid());
60     }
61 }