private void assertAccountBlotterTotal(Account a1, DateTime start, DateTime end, int total) {
   WhereFilter filter = enhanceFilterForAccountBlotter(WhereFilter.empty());
   filter.btw(
       BlotterFilter.DATETIME,
       String.valueOf(start.atMidnight().asLong()),
       String.valueOf(end.atDayEnd().asLong()));
   filter.eq(BlotterFilter.FROM_ACCOUNT_ID, String.valueOf(a1.id));
   TransactionsTotalCalculator calculator = new TransactionsTotalCalculator(db, filter);
   assertEquals(total, calculator.getAccountTotal().balance);
 }
 private void assertTotals(long... totalAmounts) {
   WhereFilter filter = WhereFilter.empty();
   TransactionsTotalCalculator calculator = new TransactionsTotalCalculator(db, filter);
   Total[] totals = calculator.getTransactionsBalance();
   assertEquals(totalAmounts.length, totals.length);
   for (int i = 0; i < totalAmounts.length; i++) {
     assertEquals("Total " + i, totalAmounts[i], totals[i].balance);
   }
 }
Esempio n. 3
0
 private Cursor getBlotterForAccount(Account account) {
   WhereFilter accountFilter = WhereFilter.copyOf(options.filter);
   accountFilter.put(Criteria.eq(BlotterFilter.FROM_ACCOUNT_ID, String.valueOf(account.id)));
   return db.getBlotterForAccount(accountFilter);
 }
 private WhereFilter createBlotterForAccountFilter(Account account) {
   WhereFilter filter = WhereFilter.empty();
   filter.put(Criteria.eq(BlotterFilter.FROM_ACCOUNT_ID, String.valueOf(account.id)));
   return filter;
 }
 @Override
 public void setUp() throws Exception {
   super.setUp();
   CategoryReport r = new CategoryReport(getContext(), c1);
   filter = r.createFilterForSubCategory(db, WhereFilter.empty(), categories.get("A").id);
 }