AccountPosition { public void add(AccountTransaction transaction){ if (transaction.ccyId() != ccyId) throw new IllegalArgumentException("Currency not match, transaction.currency="+transaction.ccyId()+", position.currency="+ccyId); this.accountTransactions.add(transaction); this.value += transaction.value(); } AccountPosition();  AccountPosition(String ccyId);  AccountPosition(Currency currency); void add(AccountTransaction transaction); @Override String toString(); @Override boolean equals(Object o); @Override int hashCode(); List<AccountTransaction> accountTransactions(); AccountPosition accountTransactions(List<AccountTransaction> accountTransactions); String ccyId(); AccountPosition ccyId(String ccyId); double value(); AccountPosition value(double value);  }
@Test(expected = IllegalArgumentException.class) public void should_throw_exception(){ AccountPosition position = new AccountPosition(Currency.USD); position.add(new AccountTransaction(Currency.HKD, 1000)); }