aboutsummaryrefslogtreecommitdiffstats
path: root/catalog-be/src
diff options
context:
space:
mode:
authorstasys10 <stasys.jurgaitis@est.tech>2021-09-02 09:44:37 +0100
committerMichael Morris <michael.morris@est.tech>2021-09-10 09:27:30 +0000
commit7ce315bd9644bcde539f5561d956a19c15e2249c (patch)
treef203a705c5a78e8d8f2281abab3b27720357246e /catalog-be/src
parentcb328c79d8f44374975befa52a103afcedf52680 (diff)
Test for GroupBusinessLogic#getNextVfModuleNameCounter
Issue-ID: SDC-3702 Signed-off-by: stasys10 <stasys.jurgaitis@est.tech> Change-Id: I72e9b838dc29edaf13385eaf3c9a6217c3e169bd
Diffstat (limited to 'catalog-be/src')
-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