From 41ce3cd080630e0206478c34d39eac1e4d1fc09d Mon Sep 17 00:00:00 2001 From: liamfallon Date: Thu, 2 May 2019 16:53:57 +0000 Subject: Fix bug in guard policy metadata creation Issue-ID: POLICY-1728 Change-Id: Ie33a30a811fcd8c128dfac87c17dcb37da6d42b4 Signed-off-by: liamfallon --- .../models/tosca/legacy/mapping/LegacyGuardPolicyMapperTest.java | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'models-tosca/src/test/java/org') diff --git a/models-tosca/src/test/java/org/onap/policy/models/tosca/legacy/mapping/LegacyGuardPolicyMapperTest.java b/models-tosca/src/test/java/org/onap/policy/models/tosca/legacy/mapping/LegacyGuardPolicyMapperTest.java index b1dac8f20..f2fb53d60 100644 --- a/models-tosca/src/test/java/org/onap/policy/models/tosca/legacy/mapping/LegacyGuardPolicyMapperTest.java +++ b/models-tosca/src/test/java/org/onap/policy/models/tosca/legacy/mapping/LegacyGuardPolicyMapperTest.java @@ -22,6 +22,8 @@ package org.onap.policy.models.tosca.legacy.mapping; import static org.assertj.core.api.Assertions.assertThatThrownBy; +import java.util.LinkedHashMap; + import org.junit.Test; import org.onap.policy.models.base.PfConceptKey; import org.onap.policy.models.tosca.simple.concepts.JpaToscaPolicies; @@ -45,6 +47,11 @@ public class LegacyGuardPolicyMapperTest { JpaToscaPolicy policy = new JpaToscaPolicy(new PfConceptKey("PolicyName", "0.0.1")); serviceTemplate.getTopologyTemplate().getPolicies().getConceptMap().put(policy.getKey(), policy); + assertThatThrownBy(() -> { + new LegacyGuardPolicyMapper().fromToscaServiceTemplate(serviceTemplate); + }).hasMessageContaining("no metadata defined on TOSCA policy"); + + policy.setMetadata(new LinkedHashMap<>()); assertThatThrownBy(() -> { new LegacyGuardPolicyMapper().fromToscaServiceTemplate(serviceTemplate); }).hasMessageContaining("no properties defined on TOSCA policy"); -- cgit 1.2.3-korg