@Test public void shouldDropLocalCommandWhenIndicesAreEqual() { final ReplaceInList toRepair1 = new ReplaceInList(SOME_LIST, SOME_CHANGE, SOME_VALUE, 4); final ReplaceInList repairAgainst1 = new ReplaceInList(SOME_LIST, SOME_CHANGE, SOME_VALUE, 4); final Optional<ReplaceInList> repaired1 = cut.repairLocalCommand(toRepair1, repairAgainst1); assertThat(repaired1.isPresent()).isFalse(); }
public Optional<ReplaceInList> repairLocalCommand(final ReplaceInList toRepair, final ReplaceInList repairAgainst) { if (toRepair.getPosition() == repairAgainst.getPosition()) { return Optional.empty(); } return Optional.of(toRepair); }
ReplaceInListRepairer { public Optional<ReplaceInList> repairLocalCommand(final ReplaceInList toRepair, final ReplaceInList repairAgainst) { if (toRepair.getPosition() == repairAgainst.getPosition()) { return Optional.empty(); } return Optional.of(toRepair); } }
ReplaceInListRepairer { public Optional<ReplaceInList> repairLocalCommand(final ReplaceInList toRepair, final ReplaceInList repairAgainst) { if (toRepair.getPosition() == repairAgainst.getPosition()) { return Optional.empty(); } return Optional.of(toRepair); }  }
ReplaceInListRepairer { public Optional<ReplaceInList> repairLocalCommand(final ReplaceInList toRepair, final ReplaceInList repairAgainst) { if (toRepair.getPosition() == repairAgainst.getPosition()) { return Optional.empty(); } return Optional.of(toRepair); }  ReplaceInList repairCommand(final ReplaceInList toRepair, final AddToList repairAgainst); ListCommand repairCommand(final ReplaceInList toRepair, final RemoveFromList repairAgainst); Optional<ReplaceInList> repairLocalCommand(final ReplaceInList toRepair, final ReplaceInList repairAgainst); ReplaceInList repairRemoteCommand(final ReplaceInList toRepair, final ReplaceInList repairAgainst); }
ReplaceInListRepairer { public Optional<ReplaceInList> repairLocalCommand(final ReplaceInList toRepair, final ReplaceInList repairAgainst) { if (toRepair.getPosition() == repairAgainst.getPosition()) { return Optional.empty(); } return Optional.of(toRepair); }  ReplaceInList repairCommand(final ReplaceInList toRepair, final AddToList repairAgainst); ListCommand repairCommand(final ReplaceInList toRepair, final RemoveFromList repairAgainst); Optional<ReplaceInList> repairLocalCommand(final ReplaceInList toRepair, final ReplaceInList repairAgainst); ReplaceInList repairRemoteCommand(final ReplaceInList toRepair, final ReplaceInList repairAgainst);  }