use of com.radixdlt.consensus.HighQC in project radixdlt by radixdlt.
the class BFTEventReducerTest method when_process_vote_with_quorum__then_processed.
@Test
public void when_process_vote_with_quorum__then_processed() {
BFTNode author = mock(BFTNode.class);
Vote vote = mock(Vote.class);
when(vote.getAuthor()).thenReturn(author);
QuorumCertificate qc = mock(QuorumCertificate.class);
HighQC highQc = mock(HighQC.class);
QuorumCertificate highestCommittedQc = mock(QuorumCertificate.class);
when(highQc.highestCommittedQC()).thenReturn(highestCommittedQc);
when(vote.getView()).thenReturn(View.of(1));
when(this.pendingVotes.insertVote(any(), any())).thenReturn(VoteProcessingResult.qcQuorum(qc));
when(this.vertexStore.highQC()).thenReturn(highQc);
// Move to view 1
this.bftEventReducer.processViewUpdate(ViewUpdate.create(View.of(1), highQc, mock(BFTNode.class), this.self));
this.bftEventReducer.processVote(vote);
verify(this.viewQuorumReachedEventDispatcher, times(1)).dispatch(any());
verify(this.pendingVotes, times(1)).insertVote(eq(vote), any());
verifyNoMoreInteractions(this.pendingVotes);
}
Aggregations