summaryrefslogtreecommitdiffstats
path: root/feature-active-standby-management/src/test
diff options
context:
space:
mode:
authorJim Hahn <jrh3@att.com>2019-07-25 09:49:44 -0400
committerJim Hahn <jrh3@att.com>2019-07-25 17:25:27 -0400
commit22e9a3560b236460c4ae5c1f7cd8dc01f15ca8ad (patch)
treedde276322f1a93f19bbd6b5cf548b13a87c75c2a /feature-active-standby-management/src/test
parentce1121d3cbe7e7706c1cd3f653436a7bdc07c2bb (diff)
Add coverage to MavenDroolsController
Change-Id: I7234c0146ef77f685a9766bb03168e385090fd1b Issue-ID: POLICY-1772 Signed-off-by: Jim Hahn <jrh3@att.com>
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);