From a30ad49b5434b0a2670d51e6aa54ee6ea82deb62 Mon Sep 17 00:00:00 2001 From: Krzysztof Gajewski Date: Fri, 29 May 2020 16:05:13 +0200 Subject: Add JUnit code coverage for InstanceResourceList: Issue-ID: SO-1576 Signed-off-by: Krzysztof Gajewski Change-Id: I51496fce24acdb8a9fc1b9fedde20b9cbbb8af68 --- .../onap/so/bpmn/common/resource/InstanceResourceList.java | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'bpmn/MSOCommonBPMN/src/main') diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/resource/InstanceResourceList.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/resource/InstanceResourceList.java index 3a4df68f02..963210b993 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/resource/InstanceResourceList.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/resource/InstanceResourceList.java @@ -109,16 +109,20 @@ public class InstanceResourceList { } // check if the resource contains vf-module - if (vnfResource != null && vnfResource.getVfModules() != null) { + if (isVnfResourceWithVfModule(vnfResource)) { sequencedResourceList.addAll(vnfResource.getVfModules()); } return sequencedResourceList; } + private static boolean isVnfResourceWithVfModule(VnfResource vnfResource) { + return vnfResource != null && vnfResource.getVfModules() != null; + } + private static List getGroupResourceInstanceList(VnfResource vnfResource, JsonObject vfObj) { List sequencedResourceList = new ArrayList<>(); - if (vnfResource.getGroupOrder() != null && !StringUtils.isEmpty(vnfResource.getGroupOrder())) { + if (isVnfGroupOrderFilled(vnfResource)) { String[] grpSequence = vnfResource.getGroupOrder().split(","); for (String grpType : grpSequence) { for (GroupResource gResource : vnfResource.getGroups()) { @@ -150,4 +154,8 @@ public class InstanceResourceList { } return sequencedResourceList; } + + private static boolean isVnfGroupOrderFilled(VnfResource vnfResource) { + return vnfResource.getGroupOrder() != null && !StringUtils.isEmpty(vnfResource.getGroupOrder()); + } } -- cgit 1.2.3-korg