X-Git-Url: https://gerrit.onap.org/r/gitweb?a=blobdiff_plain;f=models-base%2Fsrc%2Ftest%2Fjava%2Forg%2Fonap%2Fpolicy%2Fmodels%2Fbase%2FPfConceptContainerTest.java;h=f5c6e3a9b86b388980ab04fb6e08a38b27595751;hb=24e47e99077ab0b7608fca68bd30a7bc70e766c2;hp=8c74850d22a409f3ebfa35851bb68e3a17118aed;hpb=726bec7cd5e1b0f5c45b3ec58bc64e344240e8c9;p=policy%2Fmodels.git diff --git a/models-base/src/test/java/org/onap/policy/models/base/PfConceptContainerTest.java b/models-base/src/test/java/org/onap/policy/models/base/PfConceptContainerTest.java index 8c74850d2..f5c6e3a9b 100644 --- a/models-base/src/test/java/org/onap/policy/models/base/PfConceptContainerTest.java +++ b/models-base/src/test/java/org/onap/policy/models/base/PfConceptContainerTest.java @@ -1,6 +1,6 @@ /*- * ============LICENSE_START======================================================= - * Copyright (C) 2019-2020 Nordix Foundation. + * Copyright (C) 2019-2021 Nordix Foundation. * Modifications Copyright (C) 2019-2020 AT&T Intellectual Property. All rights reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); @@ -42,11 +42,6 @@ import org.onap.policy.models.base.testconcepts.DummyPfConcept; import org.onap.policy.models.base.testconcepts.DummyPfConceptContainer; import org.onap.policy.models.base.testconcepts.DummyPfConceptSub; -/** - * Test the PfCOnceptCOntainer class. - * - * @author Liam Fallon (liam.fallon@est.tech) - */ public class PfConceptContainerTest { private static final String NAME0 = "name0"; @@ -83,7 +78,11 @@ public class PfConceptContainerTest { assertThatThrownBy(() -> new DummyPfConceptContainer(null, new TreeMap())) .hasMessageMatching(KEY_IS_NULL); + } + @Test + public void testNamedConceptContainer() { + DummyPfConceptContainer container = new DummyPfConceptContainer(); container.getKey().setName(DUMMY_VALUE); DummyPfConceptContainer clonedContainer = new DummyPfConceptContainer(container); assertNotNull(clonedContainer); @@ -132,6 +131,15 @@ public class PfConceptContainerTest { PfConceptKey testConceptKey = new PfConceptKey("TestKey", VERSION0_0_1); testContainer.getConceptMap().put(testConceptKey, new DummyPfConcept(testConceptKey)); assertNotEquals(0, container.compareTo(testContainer)); + } + + @Test + public void testValidationContainer() { + DummyPfConceptContainer container = new DummyPfConceptContainer(); + PfConceptKey conceptKey = new PfConceptKey("Key", VERSION0_0_1); + Map conceptMap = new TreeMap<>(); + conceptMap.put(conceptKey, new DummyPfConcept(conceptKey)); + container.setConceptMap(conceptMap); final DummyPfConceptContainer container3 = container; assertThatThrownBy(() -> container3.validate(null)) @@ -142,6 +150,7 @@ public class PfConceptContainerTest { validateContainer.setKey(new PfConceptKey("VCKey", VERSION0_0_1)); assertTrue(validateContainer.validate("").isValid()); + PfConceptKey testConceptKey = new PfConceptKey("TestKey", VERSION0_0_1); validateContainer.getConceptMap().put(testConceptKey, new DummyPfConcept(testConceptKey)); assertTrue(validateContainer.validate("").isValid()); @@ -159,6 +168,15 @@ public class PfConceptContainerTest { assertFalse(validateContainer.validate("").isValid()); validateContainer.getConceptMap().put(testConceptKey, new DummyPfConcept(testConceptKey)); assertTrue(validateContainer.validate("").isValid()); + } + + @Test + public void testSetContainer() { + DummyPfConceptContainer container = new DummyPfConceptContainer(); + PfConceptKey conceptKey = new PfConceptKey("Key", VERSION0_0_1); + Map conceptMap = new TreeMap<>(); + conceptMap.put(conceptKey, new DummyPfConcept(conceptKey)); + container.setConceptMap(conceptMap); assertEquals(conceptKey, container.get(conceptKey).getKey()); assertEquals(conceptKey, container.get(conceptKey.getName()).getKey()); @@ -191,6 +209,7 @@ public class PfConceptContainerTest { assertEquals(conceptKey, container.get(anotherKey).getKey()); } + @Test public void testAuthorative() { Map dacMap = new LinkedHashMap<>();