@Test
@SuppressWarnings("unchecked")
public void testIsLeader() {

    long peerId = 7;
    QuorumPeer.QuorumServer quorumServerMock = mock(QuorumPeer.QuorumServer.class);
    when(quorumServerMock.getId()).thenReturn(peerId);
    QuorumPeer peerMock = mock(QuorumPeer.class);
    RemotePeerBean remotePeerBean = new RemotePeerBean(peerMock, quorumServerMock);
    when(peerMock.isLeader(eq(peerId))).thenReturn(true);
    assertTrue(remotePeerBean.isLeader());
    when(peerMock.isLeader(eq(peerId))).thenReturn(false);
    assertFalse(remotePeerBean.isLeader());
}