}
@Test
public void testPayBill() {
UserDetails user = UserDetails.findCurrentUser();
Bill bill = new Bill();
bill.setOwner(user);
bill.setAmount(100D);
bill.setCurrency(Locale.US);
bill.setLastTrigger(new Date());
bill.setPayee(Payee.findMySelf(user));
bill.setPeriod(RECURRING_INTERVAL.MONTHLY);
bill.setCategory(Subcategory.findSubcategory(1L));
bill.setDescription("a bill");
bill.persist();
Account account = Account.findAccount(3L);
int transactions = account.getTransactions().size();
accountService.payBill(user, bill, 3L, 101D, new Date());
assertNotNull("Bill updated", bill.getLastPayment());
assertTrue("Transaction created", (transactions + 1) == account.getTransactions().size());
}