@Test public void shouldRemoveDebts() throws Exception { final Debt debt = debt(thomas, amount(10), matthias); final Remove combinationResult = new Remove(debt); final List<Debt> list = new ArrayList<>(Arrays.asList(debt)); combinationResult.applyTo(list); assertThat(list, allOf( iterableWithSize(0), not(hasItem(debt)) )); }
@Override public void applyTo(Collection<Debt> existingDebts) { for (Debt debtToBeRemoved : debtsToBeRemoved) { existingDebts.remove(debtToBeRemoved); } }
Remove implements CombinationResult { @Override public void applyTo(Collection<Debt> existingDebts) { for (Debt debtToBeRemoved : debtsToBeRemoved) { existingDebts.remove(debtToBeRemoved); } } }
Remove implements CombinationResult { @Override public void applyTo(Collection<Debt> existingDebts) { for (Debt debtToBeRemoved : debtsToBeRemoved) { existingDebts.remove(debtToBeRemoved); } } Remove(Debt... debtsToBeRemoved); }
Remove implements CombinationResult { @Override public void applyTo(Collection<Debt> existingDebts) { for (Debt debtToBeRemoved : debtsToBeRemoved) { existingDebts.remove(debtToBeRemoved); } } Remove(Debt... debtsToBeRemoved); @Override boolean hasChanges(); @Override void applyTo(Collection<Debt> existingDebts); @Override boolean equals(Object o); @Override int hashCode(); @Override String toString(); }
Remove implements CombinationResult { @Override public void applyTo(Collection<Debt> existingDebts) { for (Debt debtToBeRemoved : debtsToBeRemoved) { existingDebts.remove(debtToBeRemoved); } } Remove(Debt... debtsToBeRemoved); @Override boolean hasChanges(); @Override void applyTo(Collection<Debt> existingDebts); @Override boolean equals(Object o); @Override int hashCode(); @Override String toString();  }