summaryrefslogtreecommitdiffstats
path: root/catalog-be
diff options
context:
space:
mode:
Diffstat (limited to 'catalog-be')
-rw-r--r--catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/GroupBusinessLogicTest.java59
1 files changed, 59 insertions, 0 deletions
diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/GroupBusinessLogicTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/GroupBusinessLogicTest.java
index dfb94aee7a..ac994f0797 100644
--- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/GroupBusinessLogicTest.java
+++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/GroupBusinessLogicTest.java
@@ -367,4 +367,63 @@ class GroupBusinessLogicTest {
Assertions.assertEquals("ArtTmpInfoName1", allGroups.get(0).getGroupName());
Assertions.assertEquals(expectedResponse.getStatus(), result.right().value().getStatus());
}
+
+ @Test
+ void testGetNextVfModuleNameCounter_groupNull() {
+
+ final int resultCollection = test.getNextVfModuleNameCounter((Collection <GroupDefinition>) null);
+ final int resultMap = test.getNextVfModuleNameCounter((Map<String, GroupDefinition>) null);
+
+ Assertions.assertEquals(0, resultCollection);
+ Assertions.assertEquals(0, resultMap);
+ }
+
+ @Test
+ void testGetNextVfModuleNameCounter_groupEmpty() {
+
+ final int resultCollection = test.getNextVfModuleNameCounter(new ArrayList<>());
+ final int resultMap = test.getNextVfModuleNameCounter(new HashMap<>());
+
+ Assertions.assertEquals(0, resultCollection);
+ Assertions.assertEquals(0, resultMap);
+ }
+
+ @Test
+ void testGetNextVfModuleNameCounter_takesCollectionPass() {
+
+ final Collection<GroupDefinition> group = new ArrayList<>();
+ final GroupDefinition groupDefinition1 = new GroupDefinition();
+ final GroupDefinition groupDefinition2 = new GroupDefinition();
+ final GroupDefinition groupDefinition3 = new GroupDefinition();
+ groupDefinition1.setName("resourceSystemName..ArtTmpInfoDesc1..module-0");
+ groupDefinition2.setName("resourceSystemName..ArtTmpInfoDesc1..module-9");
+ groupDefinition3.setName("resourceSystemName..ArtTmpInfoDesc2..module-1");
+ group.add(groupDefinition1);
+ group.add(groupDefinition2);
+ group.add(groupDefinition3);
+
+ final int result = test.getNextVfModuleNameCounter(group);
+
+ Assertions.assertEquals(10, result);
+ }
+
+ @Test
+ void testGetNextVfModuleNameCounter_takesMapPass() {
+
+ final Map<String, GroupDefinition> group = new HashMap<>();
+ final GroupDefinition groupDefinition1 = new GroupDefinition();
+ final GroupDefinition groupDefinition2 = new GroupDefinition();
+ final GroupDefinition groupDefinition3 = new GroupDefinition();
+ groupDefinition1.setName("resourceSystemName..ArtTmpInfoDesc1..module-0");
+ groupDefinition2.setName("resourceSystemName..ArtTmpInfoDesc1..module-9");
+ groupDefinition3.setName("resourceSystemName..ArtTmpInfoDesc2..module-1");
+
+ group.put("first", groupDefinition1);
+ group.put("second", groupDefinition2);
+ group.put("third", groupDefinition3);
+
+ final int result = test.getNextVfModuleNameCounter(group);
+
+ Assertions.assertEquals(10, result);
+ }
} \ No newline at end of file