Leadership construct includes List of NodeIds to describe current
leader/backups (candidates) for a topic. This includes removing the RoleInfo in
LeadershipEvent, to deduplicate information.

RoleInfo is also made a bit saner with the Optional leader field.

part of: Device Mastership store on top of LeadershipService
Reference: ONOS-76

Change-Id: I957c4d79125873d5a7280f60231d26d2806ab27f
diff --git a/core/api/src/test/java/org/onosproject/cluster/RoleInfoTest.java b/core/api/src/test/java/org/onosproject/cluster/RoleInfoTest.java
index 172b6f5..6a4f968 100644
--- a/core/api/src/test/java/org/onosproject/cluster/RoleInfoTest.java
+++ b/core/api/src/test/java/org/onosproject/cluster/RoleInfoTest.java
@@ -20,9 +20,9 @@
 import org.junit.Test;
 
 import com.google.common.collect.Lists;
+import com.google.common.testing.EqualsTester;
 
 import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotEquals;
 
 /**
  * Test to check behavioral correctness of the RoleInfo structure.
@@ -39,14 +39,20 @@
     private static final RoleInfo RI1 = new RoleInfo(N1, BKUP1);
     private static final RoleInfo RI2 = new RoleInfo(N1, BKUP2);
     private static final RoleInfo RI3 = new RoleInfo(N2, BKUP1);
+    private static final RoleInfo RI4 = new RoleInfo(null, BKUP2);
+
+    @Test
+    public void testEquality() {
+        new EqualsTester()
+        .addEqualityGroup(RI1, new RoleInfo(new NodeId("n1"), Lists.newArrayList(N2, N3)))
+        .addEqualityGroup(RI3);
+    }
 
     @Test
     public void basics() {
         assertEquals("wrong master", new NodeId("n1"), RI1.master());
         assertEquals("wrong Backups", RI1.backups(), Lists.newArrayList(N2, N3));
-
-        assertNotEquals("equals() broken", RI1, RI2);
-        assertNotEquals("equals() broken", RI1, RI3);
+        assertEquals("wrong empty master", RI4.master(), null);
 
         List<NodeId> bkup3 = Lists.newArrayList(N3, new NodeId("n4"));
         assertEquals("equals() broken", new RoleInfo(N1, bkup3), RI2);