2  * ============LICENSE_START=======================================================
 
   3  *  Copyright (C) 2018 Intel. All rights reserved.
 
   4  *  Modifications Copyright (C) 2020 AT&T Inc.
 
   5  * ================================================================================
 
   6  * Licensed under the Apache License, Version 2.0 (the "License");
 
   7  * you may not use this file except in compliance with the License.
 
   8  * You may obtain a copy of the License at
 
  10  *      http://www.apache.org/licenses/LICENSE-2.0
 
  12  * Unless required by applicable law or agreed to in writing, software
 
  13  * distributed under the License is distributed on an "AS IS" BASIS,
 
  14  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 
  15  * See the License for the specific language governing permissions and
 
  16  * limitations under the License.
 
  18  * SPDX-License-Identifier: Apache-2.0
 
  19  * ============LICENSE_END=========================================================
 
  22 package org.onap.policy.distribution.reception.decoding.hpa;
 
  24 import static org.junit.Assert.assertEquals;
 
  26 import org.junit.Test;
 
  29  * Class to perform unit test for Content 0f {@link Content}.
 
  32 public class TestContent {
 
  35     public void testContent() {
 
  36         final String identity = "dummyidentity";
 
  37         final String policyType = "optimization";
 
  39         final Content content = new Content();
 
  40         content.setIdentity(identity);
 
  41         content.setPolicyType(policyType);
 
  43         validateReport(identity, policyType, content);
 
  46     private void validateReport(final String identity, final String policyType,
 
  47             final Content content) {
 
  48         assertEquals(0, content.getScope().size());
 
  49         assertEquals(0, content.getGeography().size());
 
  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.getServices().size());
 
  58         content.getServices().add("vCPE");
 
  59         assertEquals(1, content.getServices().size());
 
  60         content.getServices().remove("vCPE");
 
  61         assertEquals(0, content.getServices().size());
 
  62         assertEquals(0, content.getFlavorFeatures().size());
 
  63         FlavorFeature flavorFeature = new FlavorFeature();
 
  64         content.getFlavorFeatures().add(flavorFeature);
 
  65         assertEquals(1, content.getFlavorFeatures().size());
 
  66         content.getFlavorFeatures().remove(flavorFeature);
 
  67         assertEquals(0, content.getFlavorFeatures().size());
 
  68         assertEquals(0, content.getResources().size());
 
  69         content.getResources().add("vGW");
 
  70         assertEquals(1, content.getResources().size());
 
  71         content.getResources().remove("vGW");
 
  72         assertEquals(0, content.getResources().size());