@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); final Bundle bundle = getArguments(); // TODO strict mode violation mTransaction = Transaction.getInstanceFromDb(bundle.getLong(KEY_ROWID)); }
public void testAccount() throws RemoteException, OperationApplicationException { Account account, restored = null; Long openingBalance = (long) 100; account = new Account("TestAccount", openingBalance, "Testing with Junit"); account.setCurrency("EUR"); assertEquals("EUR", account.currency.getCurrencyCode()); account.save(); assertTrue(account.getId() > 0); restored = Account.getInstanceFromDb(account.getId()); assertEquals(account, restored); Long trAmount = (long) 100; Transaction op1 = Transaction.getNewInstance(account.getId()); op1.setAmount(new Money(account.currency, trAmount)); op1.comment = "test transaction"; op1.save(); assertEquals(account.getTotalBalance().getAmountMinor().longValue(), openingBalance + trAmount); Account.delete(account.getId()); assertNull( "Account deleted, but can still be retrieved", Account.getInstanceFromDb(account.getId())); assertNull( "Account delete should delete transaction, but operation can still be retrieved", Transaction.getInstanceFromDb(op1.getId())); }