@Test
public void testSerialization() {

    byte[] data = new byte[1000];
    for (int i = 0, j = 0; i < data.length; i++) {
        data[i] = (byte)j;
        if (++j >= 255) {
            j = 0;
        }
    }
    ServerConfigurationPayload serverConfig = new ServerConfigurationPayload(Arrays.asList(
            new ServerInfo("leader", true), new ServerInfo("follower", false)));
    InstallSnapshot expected = new InstallSnapshot(3L, "leaderId", 11L, 2L, data, 5, 6, OptionalInt.of(54321),
        Optional.of(serverConfig));
    Object serialized = expected.toSerializable(RaftVersions.CURRENT_VERSION);
    assertEquals("Serialized type", InstallSnapshot.class, serialized.getClass());
    InstallSnapshot actual = (InstallSnapshot) SerializationUtils.clone((Serializable) serialized);
    verifyInstallSnapshot(expected, actual);
    expected = new InstallSnapshot(3L, "leaderId", 11L, 2L, data, 5, 6);
    actual = (InstallSnapshot) SerializationUtils.clone((Serializable) expected.toSerializable(
            RaftVersions.CURRENT_VERSION));
    verifyInstallSnapshot(expected, actual);
}