Introduce PeerInfo and VotingState
[controller.git] / opendaylight / md-sal / sal-akka-raft / src / test / java / org / opendaylight / controller / cluster / raft / RaftActorContextImplTest.java
index 5275a303d37d7a54d73286056f8db625a8f6c5dc..a2f9e78769420e5675183fa54c1fc6b123b4c21d 100644 (file)
@@ -18,6 +18,8 @@ import akka.actor.Props;
 import akka.testkit.TestActorRef;
 import com.google.common.collect.ImmutableMap;
 import com.google.common.collect.Maps;
+import java.util.HashMap;
+import java.util.Map;
 import org.junit.After;
 import org.junit.Test;
 import org.opendaylight.controller.cluster.NonPersistentDataProvider;
@@ -45,11 +47,13 @@ public class RaftActorContextImplTest extends AbstractActorTest {
 
     @Test
     public void testGetPeerAddress() {
+        Map<String, String> peerMap = new HashMap<>();
+        peerMap.put("peer1", "peerAddress1");
+        peerMap.put("peer2", null);
         DefaultConfigParamsImpl configParams = new DefaultConfigParamsImpl();
         RaftActorContextImpl context = new RaftActorContextImpl(actor, actor.underlyingActor().getContext(),
                 "test", new ElectionTermImpl(new NonPersistentDataProvider(), "test", log), -1, -1,
-                Maps.newHashMap(ImmutableMap.<String, String>of("peer1", "peerAddress1")), configParams,
-                new NonPersistentDataProvider(), log);
+                peerMap, configParams, new NonPersistentDataProvider(), log);
 
         assertEquals("getPeerAddress", "peerAddress1", context.getPeerAddress("peer1"));
         assertEquals("getPeerAddress", null, context.getPeerAddress("peer2"));