@Test
public void testLeaderInstallSnapshotState() throws IOException {

    logStart("testLeaderInstallSnapshotState");
    Map<String, String> leadersSnapshot = new HashMap<>();
    leadersSnapshot.put("1", "A");
    leadersSnapshot.put("2", "B");
    leadersSnapshot.put("3", "C");
    ByteString bs = toByteString(leadersSnapshot);
    byte[] barray = bs.toByteArray();
    LeaderInstallSnapshotState fts = new LeaderInstallSnapshotState(50, "test");
    fts.setSnapshotBytes(ByteSource.wrap(barray));
    assertEquals(bs.size(), barray.length);
    int chunkIndex = 0;
    for (int i = 0; i < barray.length; i = i + 50) {
        int length = i + 50;
        chunkIndex++;
        if (i + 50 > barray.length) {
            length = barray.length;
        }
        byte[] chunk = fts.getNextChunk();
        assertEquals("bytestring size not matching for chunk:" + chunkIndex, length - i, chunk.length);
        assertEquals("chunkindex not matching", chunkIndex, fts.getChunkIndex());
        fts.markSendStatus(true);
        if (!fts.isLastChunk(chunkIndex)) {
            fts.incrementChunkIndex();
        }
    }
    assertEquals("totalChunks not matching", chunkIndex, fts.getTotalChunks());
    fts.close();
}