Add implements CombinationResult { @Override public void applyTo(Collection<Debt> debts) { debts.addAll(debtsToBeAdded); } Add(Debt... debtsToBeAdded); @Override boolean hasChanges(); @Override void applyTo(Collection<Debt> debts); @Override boolean equals(Object o); @Override int hashCode(); @Override String toString();  }
@Test public void shouldAddItemsToList() throws Exception { final Debt debt = Debt.debt(thomas, AmountFactory.amount(10), matthias); final Add combinationResult = new Add(debt); final ArrayList<Debt> list = new ArrayList<>(); combinationResult.applyTo(list); assertThat(list, allOf( iterableWithSize(1), hasItem(debt) )); }