@Override
@After
- public void tearDown() throws Exception {
+ public void tearDown() {
if (candidate != null) {
candidate.close();
}
Mockito.doReturn(1L).when(mockElectionTerm).getCurrentTerm();
RaftActorContext raftActorContext = new RaftActorContextImpl(candidateActor, candidateActor.actorContext(),
"candidate", mockElectionTerm, -1, -1, setupPeers(4), new DefaultConfigParamsImpl(),
- new NonPersistentDataProvider(), applyState -> { }, LOG);
+ new NonPersistentDataProvider(Runnable::run), applyState -> { }, LOG);
raftActorContext.setReplicatedLog(new MockRaftActorContext.MockReplicatedLogBuilder().build());
raftActorContext.getPeerInfo("peer1").setVotingState(VotingState.NON_VOTING);
raftActorContext.getPeerInfo("peer4").setVotingState(VotingState.NON_VOTING);
@Test
@Override
- public void testHandleAppendEntriesAddSameEntryToLog() throws Exception {
+ public void testHandleAppendEntriesAddSameEntryToLog() {
MockRaftActorContext context = createActorContext();
context.getTermInformation().update(2, "test");
return new Candidate(actorContext);
}
- @Override protected MockRaftActorContext createActorContext() {
+ @Override
+ protected MockRaftActorContext createActorContext() {
return new MockRaftActorContext("candidate", getSystem(), candidateActor);
}
@Override
protected void assertStateChangesToFollowerWhenRaftRPCHasNewerTerm(final MockRaftActorContext actorContext,
- final ActorRef actorRef, final RaftRPC rpc) throws Exception {
+ final ActorRef actorRef, final RaftRPC rpc) {
super.assertStateChangesToFollowerWhenRaftRPCHasNewerTerm(actorContext, actorRef, rpc);
if (rpc instanceof RequestVote) {
assertEquals("New votedFor", ((RequestVote)rpc).getCandidateId(),