diff options
author | Jim Hahn <jrh3@att.com> | 2019-08-26 12:20:27 -0400 |
---|---|---|
committer | Jim Hahn <jrh3@att.com> | 2019-08-27 11:49:30 -0400 |
commit | fd809717ca774dfabeddd3984fbbbbdfd029601e (patch) | |
tree | a4070c2529b0be1899ece44e3687b72ed32505a4 /models-pdp/src/test/java | |
parent | a930b0105c2e45a657427cfcb41fc0330d0c2e99 (diff) |
Replace copyTo methods with copy constructors
Deleted the copyTo() method from PfConcepts and replaced uses
with deep-copy constructors. Also added mapMap() and makeCopy()
methods to PfUtils to facilitate.
Change-Id: Id6391bb806ef0dfab6c1089278bf2b514c7e303e
Issue-ID: POLICY-1600
Signed-off-by: Jim Hahn <jrh3@att.com>
Diffstat (limited to 'models-pdp/src/test/java')
3 files changed, 9 insertions, 9 deletions
diff --git a/models-pdp/src/test/java/org/onap/policy/models/pdp/persistence/concepts/JpaPdpGroupTest.java b/models-pdp/src/test/java/org/onap/policy/models/pdp/persistence/concepts/JpaPdpGroupTest.java index a2f502bcc..b40c91982 100644 --- a/models-pdp/src/test/java/org/onap/policy/models/pdp/persistence/concepts/JpaPdpGroupTest.java +++ b/models-pdp/src/test/java/org/onap/policy/models/pdp/persistence/concepts/JpaPdpGroupTest.java @@ -119,9 +119,7 @@ public class JpaPdpGroupTest { testJpaPdpGroup.setKey(new PfConceptKey(PDP_GROUP0, VERSION)); testJpaPdpGroup.fromAuthorative(testPdpGroup); - assertThatThrownBy(() -> { - testJpaPdpGroup.copyTo(null); - }).hasMessage("target is marked @NonNull but is null"); + assertThatThrownBy(() -> new JpaPdpGroup((JpaPdpGroup) null)).isInstanceOf(NullPointerException.class); assertEquals(PDP_GROUP0, testJpaPdpGroup.getKey().getName()); assertEquals(PDP_GROUP0, new JpaPdpGroup(testPdpGroup).getKey().getName()); @@ -230,5 +228,7 @@ public class JpaPdpGroupTest { assertEquals(2, testJpaPdpGroup.getKeys().size()); testJpaPdpGroup.clean(); assertEquals(2, testJpaPdpGroup.getKeys().size()); + + assertEquals(testJpaPdpGroup, new JpaPdpGroup(testJpaPdpGroup)); } } diff --git a/models-pdp/src/test/java/org/onap/policy/models/pdp/persistence/concepts/JpaPdpSubGroupTest.java b/models-pdp/src/test/java/org/onap/policy/models/pdp/persistence/concepts/JpaPdpSubGroupTest.java index 981f40f06..ad0164ad4 100644 --- a/models-pdp/src/test/java/org/onap/policy/models/pdp/persistence/concepts/JpaPdpSubGroupTest.java +++ b/models-pdp/src/test/java/org/onap/policy/models/pdp/persistence/concepts/JpaPdpSubGroupTest.java @@ -127,9 +127,7 @@ public class JpaPdpSubGroupTest { testJpaPdpSubGroup.fromAuthorative(null); }).hasMessage("pdpSubgroup is marked @NonNull but is null"); - assertThatThrownBy(() -> { - testJpaPdpSubGroup.copyTo(null); - }).hasMessage("target is marked @NonNull but is null"); + assertThatThrownBy(() -> new JpaPdpSubGroup((JpaPdpSubGroup) null)).isInstanceOf(NullPointerException.class); assertEquals(PDP_A, testJpaPdpSubGroup.getKey().getLocalName()); assertEquals(PDP_A, new JpaPdpSubGroup(testPdpSubgroup).getKey().getLocalName()); @@ -279,5 +277,7 @@ public class JpaPdpSubGroupTest { assertEquals("Prop Value", testJpaPdpSubGroup.getProperties().get("PropKey")); assertEquals(4, testJpaPdpSubGroup.getKeys().size()); + + assertEquals(testJpaPdpSubGroup, new JpaPdpSubGroup(testJpaPdpSubGroup)); } } diff --git a/models-pdp/src/test/java/org/onap/policy/models/pdp/persistence/concepts/JpaPdpTest.java b/models-pdp/src/test/java/org/onap/policy/models/pdp/persistence/concepts/JpaPdpTest.java index 5ffba10b9..b6d5161f8 100644 --- a/models-pdp/src/test/java/org/onap/policy/models/pdp/persistence/concepts/JpaPdpTest.java +++ b/models-pdp/src/test/java/org/onap/policy/models/pdp/persistence/concepts/JpaPdpTest.java @@ -99,9 +99,7 @@ public class JpaPdpTest { testJpaPdp.fromAuthorative(null); }).hasMessage("pdp is marked @NonNull but is null"); - assertThatThrownBy(() -> { - testJpaPdp.copyTo(null); - }).hasMessage("target is marked @NonNull but is null"); + assertThatThrownBy(() -> new JpaPdp((JpaPdp) null)).isInstanceOf(NullPointerException.class); assertEquals(PDP1, testJpaPdp.getKey().getLocalName()); assertEquals(PDP1, new JpaPdp(testPdp).getKey().getLocalName()); @@ -184,5 +182,7 @@ public class JpaPdpTest { assertEquals(-13, testJpaPdp.compareTo(otherJpaPdp)); testJpaPdp.setMessage("Valid Message"); assertEquals(0, testJpaPdp.compareTo(otherJpaPdp)); + + assertEquals(testJpaPdp, new JpaPdp(testJpaPdp)); } } |