Esempio n. 1
0
 public void testResetWithFilterUpdateBalance() {
   insertData();
   Money initialtotalBalance = account1.getTotalBalance();
   assertEquals(6, count(account1.getId(), null));
   WhereFilter filter = WhereFilter.empty();
   filter.put(0, new CategoryCriteria(TEST_CAT, catId));
   account1.reset(filter, Account.EXPORT_HANDLE_DELETED_UPDATE_BALANCE, null);
   Account.clear();
   assertEquals(5, count(account1.getId(), null)); // 1 Transaction deleted
   Account resetAccount = Account.getInstanceFromDb(account1.getId());
   assertEquals(initialtotalBalance, resetAccount.getTotalBalance());
 }
Esempio n. 2
0
 public void testResetWithFilterCreateHelper() {
   insertData();
   Money initialtotalBalance = account1.getTotalBalance();
   assertEquals(6, count(account1.getId(), null));
   assertEquals(1, count(account1.getId(), KEY_CATID + "=" + catId));
   assertEquals(0, count(account1.getId(), KEY_STATUS + "=" + STATUS_HELPER));
   WhereFilter filter = WhereFilter.empty();
   filter.put(0, new CategoryCriteria(TEST_CAT, catId));
   account1.reset(filter, Account.EXPORT_HANDLE_DELETED_CREATE_HELPER, null);
   Account.clear();
   assertEquals(6, count(account1.getId(), null)); // -1 Transaction deleted;+1 helper
   assertEquals(0, count(account1.getId(), KEY_CATID + "=" + catId));
   assertEquals(1, count(account1.getId(), KEY_STATUS + "=" + STATUS_HELPER));
   Account resetAccount = Account.getInstanceFromDb(account1.getId());
   assertEquals(initialtotalBalance, resetAccount.getTotalBalance());
 }