summaryrefslogtreecommitdiffstats
path: root/feature-active-standby-management/src/test
diff options
context:
space:
mode:
Diffstat (limited to 'feature-active-standby-management/src/test')
-rw-r--r--feature-active-standby-management/src/test/java/org/onap/policy/drools/activestandby/DroolsPdpObjectTest.java19
1 files changed, 19 insertions, 0 deletions
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
@@ -66,6 +66,25 @@ public class DroolsPdpObjectTest {
}
@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
pdp.setSiteName(null);