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
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=========================================================
21 package org.onap.policy.distribution.reception.decoding.pdpx;
23 import static org.junit.Assert.assertEquals;
25 import org.junit.Test;
28 * Class to perform unit test for Content 0f {@link Content}.
31 public class TestContent {
34 public void testContent() {
35 final String resources = "dummyresource";
36 final String identity = "dummyidentity";
37 final String policyType = "optimization";
39 final Content content = new Content();
40 content.setResources(resources);
41 content.setIdentity(identity);
42 content.setPolicyType(policyType);
44 validateReport(resources, identity, policyType, content);
47 private void validateReport(final String resources, final String identity, final String policyType,
48 final Content content) {
49 assertEquals(resources, content.getResources());
50 assertEquals(identity, content.getIdentity());
51 assertEquals(policyType, content.getPolicyType());
52 assertEquals(0, content.getPolicyScope().size());
53 content.getPolicyScope().add("vFW");
54 assertEquals(1, content.getPolicyScope().size());
55 content.getPolicyScope().remove("vFW");
56 assertEquals(0, content.getPolicyScope().size());
57 assertEquals(0, content.getFlavorFeatures().size());
58 FlavorFeature flavorFeature = new FlavorFeature();
59 content.getFlavorFeatures().add(flavorFeature);
60 assertEquals(1, content.getFlavorFeatures().size());
61 content.getFlavorFeatures().remove(flavorFeature);
62 assertEquals(0, content.getFlavorFeatures().size());