2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
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
11 * http://www.apache.org/licenses/LICENSE-2.0
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 * ============LICENSE_END=========================================================
21 package org.openecomp.sdc.be.model;
24 import org.junit.Assert;
25 import org.junit.Test;
26 import org.openecomp.sdc.be.model.category.CategoryDefinition;
27 import org.openecomp.sdc.be.model.category.SubCategoryDefinition;
28 import java.util.HashMap;
29 import java.util.LinkedList;
30 import java.util.List;
33 public class UploadServiceInfoTest {
35 private UploadServiceInfo createTestSubject() {
36 return new UploadServiceInfo();
40 public void testCtor() {
41 new UploadServiceInfo("mock", "mock", "mock", new LinkedList<>(), "mock", "mock", "mock", "mock/mock/mock",
42 "mock", "mock", "mock", "mock", "mock", "mock", "mock", new LinkedList<>(), "mock", "mock", "mock",
43 "mock", "mock", "mock", "mock", "mock", "mock", "mock", new HashMap<>(), "mock", "mock");
47 public void testAddSubCategory() {
48 UploadServiceInfo testSubject;
50 String subCategory = "";
53 testSubject = createTestSubject();
56 testSubject.addSubCategory(category, subCategory);
57 List<CategoryDefinition> categories = testSubject.getCategories();
58 Assert.assertNull(categories);
61 testSubject = createTestSubject();
64 testSubject.addSubCategory(category, subCategory);
65 List<CategoryDefinition> categories2 = testSubject.getCategories();
66 for (CategoryDefinition categoryDefinition : categories2) {
67 Assert.assertEquals("", categoryDefinition.getName());
71 testSubject = createTestSubject();
74 testSubject.addSubCategory(category, subCategory);
75 List<CategoryDefinition> categories3 = testSubject.getCategories();
76 for (CategoryDefinition categoryDefinition : categories3) {
77 List<SubCategoryDefinition> subcategories = categoryDefinition.getSubcategories();
78 for (SubCategoryDefinition subcategory : subcategories) {
79 Assert.assertEquals("", subcategory.getName());
84 testSubject = createTestSubject();
87 testSubject.addSubCategory(category, subCategory);
88 List<CategoryDefinition> categories4 = testSubject.getCategories();
89 for (CategoryDefinition categoryDefinition : categories4) {
90 Assert.assertEquals("mock", categoryDefinition.getName());