Fix NPE for election app when handling CANDIDATE events. Also disables running
for leadership automatically at startup.

Change-Id: I27f297fdd4b62f9cd345df88a772f76ade56d350
diff --git a/apps/test/election/src/main/java/org/onosproject/election/ElectionTest.java b/apps/test/election/src/main/java/org/onosproject/election/ElectionTest.java
index 7d6ea56..b2a7207 100644
--- a/apps/test/election/src/main/java/org/onosproject/election/ElectionTest.java
+++ b/apps/test/election/src/main/java/org/onosproject/election/ElectionTest.java
@@ -68,7 +68,6 @@
         localControllerNode = clusterService.getLocalNode();
 
         leadershipService.addListener(leadershipEventListener);
-        leadershipService.runForLeadership(appId.name());
     }
 
     @Deactivate
@@ -90,6 +89,9 @@
         public void event(LeadershipEvent event) {
 
 
+            if (event.type().equals(LeadershipEvent.Type.CANDIDATES_CHANGED)) {
+                return;
+            }
             if (!event.subject().topic().equals(appId.name())) {
                 return;         // Not our topic: ignore
             }