static boolean areAllReplicasInSync(PartitionInfo partitionInfo) {
    return Arrays.asList(partitionInfo.inSyncReplicas()).containsAll(Arrays.asList(partitionInfo.replicas()));
  }
@Test
  public void testAreAllReplicasInSync() {
    // Verify: If isr is the same as replicas, all replicas are in-sync
    Node[] replicas = new Node[2];
    replicas[0] = NODE_0;
    replicas[1] = NODE_1;

    Node[] isr = new Node[2];
    isr[0] = NODE_0;
    isr[1] = NODE_1;
    PartitionInfo partitionInfo = new PartitionInfo(TP.topic(), TP.partition(), NODE_1, replicas, isr);
    assertTrue(ExecutionProposal.areAllReplicasInSync(partitionInfo));

    // Verify: If isr is smaller than replicas, not all replicas are in-sync
    Node[] smallIsr = new Node[1];
    smallIsr[0] = NODE_0;
    partitionInfo = new PartitionInfo(TP.topic(), TP.partition(), NODE_1, replicas, smallIsr);
    assertFalse(ExecutionProposal.areAllReplicasInSync(partitionInfo));

    // Verify: If isr is greater than replicas, all replicas are in-sync
    Node[] greaterIsr = new Node[3];
    greaterIsr[0] = NODE_0;
    greaterIsr[1] = NODE_1;
    greaterIsr[2] = NODE_2;
    partitionInfo = new PartitionInfo(TP.topic(), TP.partition(), NODE_1, replicas, greaterIsr);
    assertTrue(ExecutionProposal.areAllReplicasInSync(partitionInfo));

    // Verify: If isr has the same size as replicas, but replicas are not same as in-sync replicas, then not all replicas are in-sync.
    Node[] isrWithDifferentBrokerIds = new Node[2];
    isrWithDifferentBrokerIds[0] = NODE_0;
    isrWithDifferentBrokerIds[1] = NODE_2;
    partitionInfo = new PartitionInfo(TP.topic(), TP.partition(), NODE_1, replicas, isrWithDifferentBrokerIds);
    assertFalse(ExecutionProposal.areAllReplicasInSync(partitionInfo));
  }