diff options
Diffstat (limited to 'models-tosca/src/test')
2 files changed, 20 insertions, 4 deletions
diff --git a/models-tosca/src/test/java/org/onap/policy/models/tosca/authorative/concepts/ToscaPolicyConceptIdentifierTest.java b/models-tosca/src/test/java/org/onap/policy/models/tosca/authorative/concepts/ToscaPolicyConceptIdentifierTest.java index 6f49fd433..993c21e35 100644 --- a/models-tosca/src/test/java/org/onap/policy/models/tosca/authorative/concepts/ToscaPolicyConceptIdentifierTest.java +++ b/models-tosca/src/test/java/org/onap/policy/models/tosca/authorative/concepts/ToscaPolicyConceptIdentifierTest.java @@ -1,4 +1,4 @@ -/* +/*- * ============LICENSE_START======================================================= * ONAP Policy Models * ================================================================================ @@ -30,6 +30,7 @@ import static org.junit.Assert.assertTrue; import org.junit.Test; import org.onap.policy.common.parameters.ValidationResult; +import org.onap.policy.models.base.PfConceptKey; /** * Test methods not tested by {@link PojosTest}. @@ -52,7 +53,8 @@ public class ToscaPolicyConceptIdentifierTest extends ToscaIdentifierTestBase<To @Test public void testCopyConstructor() { - assertThatThrownBy(() -> new ToscaConceptIdentifier(null)).isInstanceOf(NullPointerException.class); + assertThatThrownBy(() -> new ToscaConceptIdentifier((ToscaConceptIdentifier) null)) + .isInstanceOf(NullPointerException.class); ToscaConceptIdentifier orig = new ToscaConceptIdentifier(); @@ -64,6 +66,19 @@ public class ToscaPolicyConceptIdentifierTest extends ToscaIdentifierTestBase<To assertEquals(orig.toString(), new ToscaConceptIdentifier(orig).toString()); } + + @Test + public void testPfKey() { + assertThatThrownBy(() -> new ToscaConceptIdentifier((PfConceptKey) null)) + .isInstanceOf(NullPointerException.class); + + PfConceptKey origKey = new PfConceptKey("Hello", "0.0.1"); + + assertEquals(origKey.getName(), new ToscaConceptIdentifier(origKey).getName()); + + assertEquals(origKey, new ToscaConceptIdentifier(origKey).asConceptKey()); + } + @Test public void testValidatePapRest() throws Exception { ToscaConceptIdentifier ident = new ToscaConceptIdentifier(NAME, VERSION); diff --git a/models-tosca/src/test/java/org/onap/policy/models/tosca/authorative/concepts/ToscaPolicyTypeConceptIdentifierTest.java b/models-tosca/src/test/java/org/onap/policy/models/tosca/authorative/concepts/ToscaPolicyTypeConceptIdentifierTest.java index 7845a1f32..d37f29360 100644 --- a/models-tosca/src/test/java/org/onap/policy/models/tosca/authorative/concepts/ToscaPolicyTypeConceptIdentifierTest.java +++ b/models-tosca/src/test/java/org/onap/policy/models/tosca/authorative/concepts/ToscaPolicyTypeConceptIdentifierTest.java @@ -1,4 +1,4 @@ -/* +/*- * ============LICENSE_START======================================================= * ONAP Policy Models * ================================================================================ @@ -52,7 +52,8 @@ public class ToscaPolicyTypeConceptIdentifierTest extends ToscaIdentifierTestBas @Test public void testCopyConstructor() { - assertThatThrownBy(() -> new ToscaConceptIdentifier(null)).isInstanceOf(NullPointerException.class); + assertThatThrownBy(() -> new ToscaConceptIdentifier((ToscaConceptIdentifier) null)) + .isInstanceOf(NullPointerException.class); ToscaConceptIdentifier orig = new ToscaConceptIdentifier(); |