### Question:
TransactionsProvider extends ModelProvider { public static Uri uriTransactions() { return uriModels(TransactionsProvider.class, Tables.Transactions.TABLE_NAME); }  static Uri uriTransactions(); static Uri uriTransaction(String transactionId); static void updateAccountBalance(SQLiteDatabase database, String accountId); static void updateAllAccountsBalances(SQLiteDatabase database); static final String URI_PARAM_JOIN_TABLE; static final String URI_VALUE_JOIN_TABLE_ACCOUNTS_FROM; static final String URI_VALUE_JOIN_TABLE_ACCOUNTS_TO; static final String URI_VALUE_JOIN_TABLE_CATEGORIES; static final String URI_VALUE_JOIN_TABLE_TAGS; }### Answer:
@Test public void insert_updatesAccountsBalances() { Account account = insertAccount(); final Transaction transaction = new Transaction(); transaction.setAccountFrom(account); transaction.setCategory(Category.getExpense()); transaction.setAmount(42); insert(TransactionsProvider.uriTransactions(), transaction); account = getAccount(account.getId()); assertEquals(-42, account.getBalance()); }
@Test(expected = IllegalArgumentException.class) public void update_throwsIllegalArgumentException() { update(TransactionsProvider.uriTransactions(), new ContentValues(), null); }
@Test public void delete_updatesAccountsBalances() { Account account = insertAccount(); final Transaction transaction = new Transaction(); transaction.setAccountFrom(account); transaction.setCategory(Category.getExpense()); transaction.setAmount(42); insert(TransactionsProvider.uriTransactions(), transaction); delete("delete", TransactionsProvider.uriTransactions(), null); account = getAccount(account.getId()); assertEquals(0, account.getBalance()); }
@Test public void bulkInsert_updatesAccountsBalances() { Account account = insertAccount(); final Transaction transaction = new Transaction(); transaction.setAccountTo(account); transaction.setCategory(Category.getIncome()); transaction.setAmount(42); bulkInsert(TransactionsProvider.uriTransactions(), transaction.asContentValues()); account = getAccount(account.getId()); assertEquals(42, account.getBalance()); }