@Test
public void copyWithReplacement() {

	Transaction t1 = MockTransaction.create("2015-01-02", "a", 123);
	Transaction t2 = MockTransaction.create("2015-01-02", "a", 123);
	Transaction t3 = t1.withCategoryName("a cat");
	Transactions transactions = new Transactions(ImmutableList.of(t1, t2));
	Transactions copyWithReplacement = transactions.copyWithReplacement(t3);
	assertNotNull(copyWithReplacement);
	assertNotSame(transactions, copyWithReplacement);
	assertSame(t3, copyWithReplacement.byId(t3.getId()));
	assertSame(t1, transactions.byId(t1.getId()));
	assertEquals(ImmutableList.of(t1, t2), transactions.getTransactions());
	assertEquals(ImmutableList.of(t3, t2), copyWithReplacement.getTransactions());
}