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 identity = "dummyidentity";
 
  36         final String policyType = "optimization";
 
  38         final Content content = new Content();
 
  39         content.setIdentity(identity);
 
  40         content.setPolicyType(policyType);
 
  42         validateReport(identity, policyType, content);
 
  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());