diff options
author | vasraz <vasyl.razinkov@est.tech> | 2020-03-26 17:25:54 +0000 |
---|---|---|
committer | Ofir Sonsino <ofir.sonsino@intl.att.com> | 2020-03-30 05:11:15 +0000 |
commit | ee80eb11d8ace0117ea1084c5ac16d8d271b8fd9 (patch) | |
tree | 7fb61496a0fc01087fb2760da4bc9ff044b21a8b /catalog-model/src/test/java | |
parent | 7422f22140b7ce24e3e735dabaa325e2f7a4fc92 (diff) |
Increase test coverage
Change-Id: If9b371042a42213f38828f9628714d076261f25c
Signed-off-by: Vasyl Razinkov <vasyl.razinkov@est.tech>
Issue-ID: SDC-2833
Diffstat (limited to 'catalog-model/src/test/java')
3 files changed, 70 insertions, 98 deletions
diff --git a/catalog-model/src/test/java/org/openecomp/sdc/be/model/category/CategoryDefinitionTest.java b/catalog-model/src/test/java/org/openecomp/sdc/be/model/category/CategoryDefinitionTest.java index d522b6d94f..db26e6ed22 100644 --- a/catalog-model/src/test/java/org/openecomp/sdc/be/model/category/CategoryDefinitionTest.java +++ b/catalog-model/src/test/java/org/openecomp/sdc/be/model/category/CategoryDefinitionTest.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -20,58 +20,25 @@ package org.openecomp.sdc.be.model.category; -import java.util.List; - +import org.assertj.core.api.Assertions; import org.junit.Test; public class CategoryDefinitionTest { - private CategoryDefinition createTestSubject() { - return new CategoryDefinition(); - } - - - @Test - public void testGetSubcategories() throws Exception { - CategoryDefinition testSubject; - List<SubCategoryDefinition> result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getSubcategories(); - } - - - @Test - public void testSetSubcategories() throws Exception { - CategoryDefinition testSubject; - List<SubCategoryDefinition> subcategories = null; - - // default test - testSubject = createTestSubject(); - testSubject.setSubcategories(subcategories); - } - - - @Test - public void testAddSubCategory() throws Exception { - CategoryDefinition testSubject; - SubCategoryDefinition subcategory = null; + private CategoryDefinition createTestSubject() { + return new CategoryDefinition(); + } - // default test - testSubject = createTestSubject(); - testSubject.addSubCategory(subcategory); - } + @Test + public void testAddSubCategory() throws Exception { + final CategoryDefinition testSubject; + final SubCategoryDefinition subcategory = new SubCategoryDefinition(); - - @Test - public void testToString() throws Exception { - CategoryDefinition testSubject; - String result; + // default test + testSubject = createTestSubject(); + testSubject.addSubCategory(subcategory); + Assertions.assertThat(testSubject.getSubcategories()).isNotNull().isNotEmpty(); + } - // default test - testSubject = createTestSubject(); - result = testSubject.toString(); - } } diff --git a/catalog-model/src/test/java/org/openecomp/sdc/be/model/category/GroupingDefinitionTest.java b/catalog-model/src/test/java/org/openecomp/sdc/be/model/category/GroupingDefinitionTest.java new file mode 100644 index 0000000000..a06d3fed48 --- /dev/null +++ b/catalog-model/src/test/java/org/openecomp/sdc/be/model/category/GroupingDefinitionTest.java @@ -0,0 +1,40 @@ +/*- + * ============LICENSE_START======================================================= + * SDC + * ================================================================================ + * Copyright (C) 2020, Nordix Foundation. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.sdc.be.model.category; + +import org.assertj.core.api.Assertions; +import org.junit.Test; +import org.openecomp.sdc.be.datatypes.category.GroupingDataDefinition; + +public class GroupingDefinitionTest { + + @Test + public void testCtor() { + final GroupingDefinition testSubject = new GroupingDefinition(); + Assertions.assertThat(testSubject).isNotNull().isInstanceOf(GroupingDefinition.class); + } + + @Test + public void testClone() { + final GroupingDefinition testSubject = new GroupingDefinition(new GroupingDataDefinition()); + Assertions.assertThat(testSubject).isNotNull().isInstanceOf(GroupingDefinition.class); + } +}
\ No newline at end of file diff --git a/catalog-model/src/test/java/org/openecomp/sdc/be/model/category/SubCategoryDefinitionTest.java b/catalog-model/src/test/java/org/openecomp/sdc/be/model/category/SubCategoryDefinitionTest.java index 7a42c870f5..f2fc17844f 100644 --- a/catalog-model/src/test/java/org/openecomp/sdc/be/model/category/SubCategoryDefinitionTest.java +++ b/catalog-model/src/test/java/org/openecomp/sdc/be/model/category/SubCategoryDefinitionTest.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -20,58 +20,23 @@ package org.openecomp.sdc.be.model.category; -import java.util.List; - import org.junit.Test; - +import org.assertj.core.api.Assertions; public class SubCategoryDefinitionTest { - private SubCategoryDefinition createTestSubject() { - return new SubCategoryDefinition(); - } - - - @Test - public void testGetGroupings() throws Exception { - SubCategoryDefinition testSubject; - List<GroupingDefinition> result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getGroupings(); - } - - - @Test - public void testSetGroupings() throws Exception { - SubCategoryDefinition testSubject; - List<GroupingDefinition> groupingDefinitions = null; - - // default test - testSubject = createTestSubject(); - testSubject.setGroupings(groupingDefinitions); - } - - - @Test - public void testAddGrouping() throws Exception { - SubCategoryDefinition testSubject; - GroupingDefinition groupingDefinition = null; - - // default test - testSubject = createTestSubject(); - testSubject.addGrouping(groupingDefinition); - } + private SubCategoryDefinition createTestSubject() { + return new SubCategoryDefinition(); + } - - @Test - public void testToString() throws Exception { - SubCategoryDefinition testSubject; - String result; + @Test + public void testAddGrouping() throws Exception { + final SubCategoryDefinition testSubject; + final GroupingDefinition groupingDefinition = new GroupingDefinition(); - // default test - testSubject = createTestSubject(); - result = testSubject.toString(); - } + // default test + testSubject = createTestSubject(); + testSubject.addGrouping(groupingDefinition); + Assertions.assertThat(testSubject.getGroupings()).isNotNull().isNotEmpty(); + } } |