@Test
public void testSerialization() throws IOException, ClassNotFoundException {

    List<ClusterNode> nodes = new ArrayList<>();
    for (int i = 0; i < 10; i++)
        nodes.add(node(metrics, ver, "1" + i));
    GridAffinityAssignmentV2 gridAffinityAssignment2 = new GridAffinityAssignmentV2(
        new AffinityTopologyVersion(1, 0),
        new ArrayList<List<ClusterNode>>() {{
            add(nodes);
        }},
        new ArrayList<>()
    );
    ByteArrayOutputStream byteArrOutputStream = new ByteArrayOutputStream();
    ObjectOutputStream outputStream = new ObjectOutputStream(byteArrOutputStream);
    outputStream.writeObject(gridAffinityAssignment2);
    ObjectInputStream inputStream = new ObjectInputStream(new ByteArrayInputStream(byteArrOutputStream.toByteArray()));
    GridAffinityAssignmentV2 deserialized = (GridAffinityAssignmentV2)inputStream.readObject();
    assertEquals(deserialized.topologyVersion(), gridAffinityAssignment2.topologyVersion());
}