From 2ce1a664e36a787b566d252c0604049c0b8d2652 Mon Sep 17 00:00:00 2001 From: "Sindhuri.A" Date: Sun, 28 Oct 2018 23:52:25 +0530 Subject: UT-enhance NodeTemplateOperationTest2 UT for catalog model NodeTemplateOperation class Issue-ID: SDC-1775 Change-Id: I935f6cebcf12263c6f03f116a55056b290fb215a Signed-off-by: Sindhuri.A --- .../operations/NodeTemplateOperationTest.java | 31 +++++++++++++++------- 1 file changed, 21 insertions(+), 10 deletions(-) diff --git a/catalog-model/src/test/java/org/openecomp/sdc/be/model/jsontitan/operations/NodeTemplateOperationTest.java b/catalog-model/src/test/java/org/openecomp/sdc/be/model/jsontitan/operations/NodeTemplateOperationTest.java index 1822ad3500..49d0f9bf8d 100644 --- a/catalog-model/src/test/java/org/openecomp/sdc/be/model/jsontitan/operations/NodeTemplateOperationTest.java +++ b/catalog-model/src/test/java/org/openecomp/sdc/be/model/jsontitan/operations/NodeTemplateOperationTest.java @@ -48,6 +48,7 @@ import org.openecomp.sdc.be.datatypes.elements.MapListCapabilityDataDefinition; import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus; import org.openecomp.sdc.common.api.ArtifactGroupTypeEnum; +import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -272,16 +273,26 @@ public class NodeTemplateOperationTest extends ModelTestBase { @Test public void testPrepareCalculatedCapabiltyForNodeType() throws Exception { - NodeTemplateOperation testSubject; - Map capabilities = null; - ComponentInstanceDataDefinition componentInstance = null; - MapListCapabilityDataDefinition result; - - // test 1 - testSubject = createTestSubject(); - capabilities = null; - result = testSubject.prepareCalculatedCapabiltyForNodeType(capabilities, componentInstance); - Assert.assertEquals(null, result); + NodeTemplateOperation testSubject; + Map capabilities = new HashMap<>(); + ListCapabilityDataDefinition listCapDataDefinition = new ListCapabilityDataDefinition(); + List listToscaDataDefinition = new ArrayList<>(); + CapabilityDataDefinition capabilityDataDefinition = new CapabilityDefinition(); + capabilityDataDefinition.setMaxOccurrences("1"); + listToscaDataDefinition.add(capabilityDataDefinition); + listCapDataDefinition.setListToscaDataDefinition(listToscaDataDefinition); + capabilities.put("1", listCapDataDefinition); + ComponentInstanceDataDefinition componentInstance = new ComponentInstance(); + String id = "id"; + componentInstance.setComponentUid(id); + componentInstance.setUniqueId(id); + componentInstance.setName(id); + MapListCapabilityDataDefinition result; + + // test 1 + testSubject = createTestSubject(); + result = testSubject.prepareCalculatedCapabiltyForNodeType(capabilities, componentInstance); + Assert.assertEquals(1, result.getMapToscaDataDefinition().size()); } -- cgit 1.2.3-korg