From 22e9a3560b236460c4ae5c1f7cd8dc01f15ca8ad Mon Sep 17 00:00:00 2001 From: Jim Hahn Date: Thu, 25 Jul 2019 09:49:44 -0400 Subject: Add coverage to MavenDroolsController Change-Id: I7234c0146ef77f685a9766bb03168e385090fd1b Issue-ID: POLICY-1772 Signed-off-by: Jim Hahn --- .../drools/activestandby/DroolsPdpObjectTest.java | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'feature-active-standby-management/src/test/java/org') diff --git a/feature-active-standby-management/src/test/java/org/onap/policy/drools/activestandby/DroolsPdpObjectTest.java b/feature-active-standby-management/src/test/java/org/onap/policy/drools/activestandby/DroolsPdpObjectTest.java index 310f9110..842d6c7f 100644 --- a/feature-active-standby-management/src/test/java/org/onap/policy/drools/activestandby/DroolsPdpObjectTest.java +++ b/feature-active-standby-management/src/test/java/org/onap/policy/drools/activestandby/DroolsPdpObjectTest.java @@ -65,6 +65,25 @@ public class DroolsPdpObjectTest { assertFalse(pdp.equals("")); } + @Test + public void testHashCode() { + int hc = pdp.hashCode(); + + // same data should yield same hash code + assertEquals(hc, pdp.hashCode()); + assertEquals(hc, makePdp(PDP_ID, SITE, PRIORITY).hashCode()); + + // different data should yield different hash code + assertTrue(makePdp(PDP_ID2, SITE, PRIORITY).hashCode() != hc); + + // these fields have no impact on hash code + assertEquals(hc, makePdp(PDP_ID, SITE, PRIORITY2).hashCode()); + assertEquals(hc, makePdp(PDP_ID, SITE2, PRIORITY).hashCode()); + + // should not throw an exception + new MyPdp().hashCode(); + } + @Test public void testNullSafeCompare() { // self, when null -- cgit 1.2.3-korg