X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?p=controller.git;a=blobdiff_plain;f=opendaylight%2Fmd-sal%2Fsal-akka-raft%2Fsrc%2Ftest%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fcluster%2Fraft%2Fbehaviors%2FCandidateTest.java;h=40080a8c72ba7978d365057fcd875897307048b4;hp=6e5c9315025a9ab68950245eafee0861bf697547;hb=5e590ea1548dd4974ca59f1318a11f2a8651c3b7;hpb=364229dd715facec8ef8c73d6c60546c5f38b103 diff --git a/opendaylight/md-sal/sal-akka-raft/src/test/java/org/opendaylight/controller/cluster/raft/behaviors/CandidateTest.java b/opendaylight/md-sal/sal-akka-raft/src/test/java/org/opendaylight/controller/cluster/raft/behaviors/CandidateTest.java index 6e5c931502..40080a8c72 100644 --- a/opendaylight/md-sal/sal-akka-raft/src/test/java/org/opendaylight/controller/cluster/raft/behaviors/CandidateTest.java +++ b/opendaylight/md-sal/sal-akka-raft/src/test/java/org/opendaylight/controller/cluster/raft/behaviors/CandidateTest.java @@ -313,7 +313,7 @@ public class CandidateTest extends AbstractRaftActorBehaviorTest { context.getTermInformation().update(2, "test"); // Send an unknown message so that the state of the RaftActor remains unchanged - RaftActorBehavior expected = behavior.handleMessage(candidateActor, "unknown"); + behavior.handleMessage(candidateActor, "unknown"); RaftActorBehavior raftBehavior = behavior.handleMessage(candidateActor, appendEntries); @@ -333,6 +333,7 @@ public class CandidateTest extends AbstractRaftActorBehaviorTest { return new MockRaftActorContext("candidate", getSystem(), candidateActor); } + @SuppressWarnings("unchecked") private Map setupPeers(final int count) { Map peerMap = new HashMap<>(); peerActors = new TestActorRef[count]; @@ -349,6 +350,10 @@ public class CandidateTest extends AbstractRaftActorBehaviorTest { protected void assertStateChangesToFollowerWhenRaftRPCHasNewerTerm(final MockRaftActorContext actorContext, final ActorRef actorRef, final RaftRPC rpc) throws Exception { super.assertStateChangesToFollowerWhenRaftRPCHasNewerTerm(actorContext, actorRef, rpc); - assertEquals("New votedFor", null, actorContext.getTermInformation().getVotedFor()); + if(rpc instanceof RequestVote) { + assertEquals("New votedFor", ((RequestVote)rpc).getCandidateId(), actorContext.getTermInformation().getVotedFor()); + } else { + assertEquals("New votedFor", null, actorContext.getTermInformation().getVotedFor()); + } } }