d678239f67563309604622fa1b28e69a1bf87286
[policy/distribution.git] /
1 /*-
2  * ============LICENSE_START=======================================================
3  *  Copyright (C) 2018 Intel. All rights reserved.
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
21 package org.onap.policy.distribution.reception.decoding.pdpx;
22
23 import static org.junit.Assert.assertEquals;
24
25 import org.junit.Test;
26
27 /**
28  * Class to perform unit test for Content 0f {@link Content}.
29  *
30  */
31 public class TestContent {
32
33     @Test
34     public void testContent() {
35         final String identity = "dummyidentity";
36         final String policyType = "optimization";
37
38         final Content content = new Content();
39         content.setIdentity(identity);
40         content.setPolicyType(policyType);
41
42         validateReport(identity, policyType, content);
43     }
44
45     private void validateReport(final String identity, final String policyType,
46             final Content content) {
47         assertEquals(identity, content.getIdentity());
48         assertEquals(policyType, content.getPolicyType());
49         assertEquals(0, content.getPolicyScope().size());
50         content.getPolicyScope().add("vFW");
51         assertEquals(1, content.getPolicyScope().size());
52         content.getPolicyScope().remove("vFW");
53         assertEquals(0, content.getPolicyScope().size());
54         assertEquals(0, content.getFlavorFeatures().size());
55         FlavorFeature flavorFeature = new FlavorFeature();
56         content.getFlavorFeatures().add(flavorFeature);
57         assertEquals(1, content.getFlavorFeatures().size());
58         content.getFlavorFeatures().remove(flavorFeature);
59         assertEquals(0, content.getFlavorFeatures().size());
60         assertEquals(0, content.getResources().size());
61         content.getResources().add("vGW");
62         assertEquals(1, content.getResources().size());
63         content.getResources().remove("vGW");
64         assertEquals(0, content.getResources().size());
65     }
66 }