### Question:
VnodeRepairState { public boolean isSameVnode(VnodeRepairState other) { return getTokenRange().equals(other.getTokenRange()) && getReplicas().equals(other.getReplicas()); } VnodeRepairState(LongTokenRange tokenRange, ImmutableSet<Host> replicas, long lastRepairedAt); LongTokenRange getTokenRange(); ImmutableSet<Host> getReplicas(); long lastRepairedAt(); boolean isSameVnode(VnodeRepairState other); @Override String toString(); @Override boolean equals(Object o); @Override int hashCode(); static final long UNREPAIRED; }### Answer:
@Test public void testVnodeWithDifferentReplicasIsNotSame() { LongTokenRange range = new LongTokenRange(1, 2); Host host1 = mock(Host.class); Host host2 = mock(Host.class); Host host3 = mock(Host.class); VnodeRepairState vnodeRepairState = new VnodeRepairState(range, ImmutableSet.of(host1, host2), VnodeRepairState.UNREPAIRED); VnodeRepairState otherVnodeRepairState = new VnodeRepairState(range, ImmutableSet.of(host1, host3), VnodeRepairState.UNREPAIRED); assertThat(vnodeRepairState.isSameVnode(otherVnodeRepairState)).isFalse(); }
@Test public void testDifferentVnodesAreNotSame() { LongTokenRange range = new LongTokenRange(1, 2); LongTokenRange otherRange = new LongTokenRange(2, 3); Host host1 = mock(Host.class); Host host2 = mock(Host.class); Host host3 = mock(Host.class); VnodeRepairState vnodeRepairState = new VnodeRepairState(range, ImmutableSet.of(host1, host2, host3), VnodeRepairState.UNREPAIRED); VnodeRepairState otherVnodeRepairState = new VnodeRepairState(otherRange, ImmutableSet.of(host1, host2, host3), VnodeRepairState.UNREPAIRED); assertThat(vnodeRepairState.isSameVnode(otherVnodeRepairState)).isFalse(); }