summaryrefslogtreecommitdiffstats
path: root/models-base/src
diff options
context:
space:
mode:
Diffstat (limited to 'models-base/src')
-rw-r--r--models-base/src/main/java/org/onap/policy/models/base/PfConceptContainer.java5
-rw-r--r--models-base/src/test/java/org/onap/policy/models/base/PfConceptContainerTest.java19
2 files changed, 11 insertions, 13 deletions
diff --git a/models-base/src/main/java/org/onap/policy/models/base/PfConceptContainer.java b/models-base/src/main/java/org/onap/policy/models/base/PfConceptContainer.java
index 2ecf8c1c6..949cb96dc 100644
--- a/models-base/src/main/java/org/onap/policy/models/base/PfConceptContainer.java
+++ b/models-base/src/main/java/org/onap/policy/models/base/PfConceptContainer.java
@@ -234,10 +234,7 @@ public class PfConceptContainer<C extends PfConcept, A extends PfNameVersion> ex
result = key.validate(result);
- if (conceptMap.isEmpty()) {
- result.addValidationMessage(new PfValidationMessage(key, this.getClass(), ValidationResult.INVALID,
- "conceptMap may not be empty"));
- } else {
+ if (!conceptMap.isEmpty()) {
result = validateConceptMap(result);
}
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 5e84dff9a..b760e17c0 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 Nordix Foundation.
+ * Copyright (C) 2019-2020 Nordix Foundation.
* Modifications Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -33,6 +33,7 @@ import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.TreeMap;
+
import org.junit.Test;
import org.onap.policy.models.base.testconcepts.DummyAuthorativeConcept;
import org.onap.policy.models.base.testconcepts.DummyBadPfConceptContainer;
@@ -54,7 +55,7 @@ public class PfConceptContainerTest {
private static final String DUMMY_VALUE = "Dummy";
private static final String VERSION0 = "0.0.1";
- @SuppressWarnings({ "unchecked", "rawtypes" })
+ @SuppressWarnings({"unchecked", "rawtypes"})
@Test
public void testConceptContainer() {
DummyPfConceptContainer container = new DummyPfConceptContainer();
@@ -74,10 +75,10 @@ public class PfConceptContainerTest {
assertThatThrownBy(() -> new DummyPfConceptContainer((PfConceptKey) null, null)).hasMessage(KEY_IS_NULL);
assertThatThrownBy(() -> new DummyPfConceptContainer(new PfConceptKey(), null))
- .hasMessage("conceptMap is marked @NonNull but is null");
+ .hasMessage("conceptMap is marked @NonNull but is null");
assertThatThrownBy(() -> new DummyPfConceptContainer(null, new TreeMap<PfConceptKey, DummyPfConcept>()))
- .hasMessage(KEY_IS_NULL);
+ .hasMessage(KEY_IS_NULL);
container.getKey().setName(DUMMY_VALUE);
DummyPfConceptContainer clonedContainer = new DummyPfConceptContainer(container);
@@ -85,7 +86,7 @@ public class PfConceptContainerTest {
assertEquals(DUMMY_VALUE, clonedContainer.getKey().getName());
assertThatThrownBy(() -> new DummyPfConceptContainer((DummyPfConceptContainer) null))
- .hasMessage("copyConcept is marked @NonNull but is null");
+ .hasMessage("copyConcept is marked @NonNull but is null");
List<PfKey> keyList = container.getKeys();
assertEquals(1, keyList.size());
@@ -114,7 +115,7 @@ public class PfConceptContainerTest {
assertEquals(0, container.compareTo(clonedContainer));
assertThatThrownBy(() -> new DummyPfConceptContainer((DummyPfConceptContainer) null))
- .isInstanceOf(NullPointerException.class);
+ .isInstanceOf(NullPointerException.class);
assertFalse(container.compareTo(null) == 0);
assertEquals(0, container.compareTo(container));
@@ -136,7 +137,7 @@ public class PfConceptContainerTest {
DummyPfConceptContainer validateContainer = new DummyPfConceptContainer();
assertFalse(validateContainer.validate(new PfValidationResult()).isOk());
validateContainer.setKey(new PfConceptKey("VCKey", VERSION0));
- assertFalse(validateContainer.validate(new PfValidationResult()).isOk());
+ assertTrue(validateContainer.validate(new PfValidationResult()).isOk());
validateContainer.getConceptMap().put(testConceptKey, new DummyPfConcept(testConceptKey));
assertTrue(validateContainer.validate(new PfValidationResult()).isOk());
@@ -194,11 +195,11 @@ public class PfConceptContainerTest {
DummyBadPfConceptContainer badContainer = new DummyBadPfConceptContainer();
assertThatThrownBy(() -> badContainer.fromAuthorative(authorativeList))
- .hasMessage("failed to instantiate instance of container concept class");
+ .hasMessage("failed to instantiate instance of container concept class");
authorativeList.clear();
assertThatThrownBy(() -> container.fromAuthorative(authorativeList))
- .hasMessage("An incoming list of concepts must have at least one entry");
+ .hasMessage("An incoming list of concepts must have at least one entry");
}
@Test(expected = NullPointerException.class)