Exemplo n.º 1
0
  public void test_should_calculate_correct_report_with_multiple_currencies_2() {
    RateBuilder.withDb(db).at(DateTime.today()).from(c2).to(c1).rate(0.1f).create();
    TransactionBuilder.withDb(db)
        .account(a1)
        .category(categories.get("A"))
        .dateTime(DateTime.today())
        .amount(-100)
        .create();
    TransactionBuilder.withDb(db)
        .account(a1)
        .category(categories.get("A1"))
        .dateTime(DateTime.today())
        .amount(-100)
        .create();
    TransactionBuilder.withDb(db)
        .account(a3)
        .category(categories.get("A2"))
        .dateTime(DateTime.today())
        .amount(250)
        .create();
    TransactionBuilder.withDb(db)
        .account(a1)
        .category(categories.get("B"))
        .dateTime(DateTime.today())
        .amount(500)
        .create();
    TransactionBuilder.withDb(db)
        .account(a3)
        .dateTime(DateTime.today())
        .amount(-5000)
        .withSplit(categories.get("A1"), -1000)
        .withSplit(categories.get("A2"), -2200)
        .withSplit(categories.get("B"), -1800)
        .create();
    List<GraphUnit> units = assertReportReturnsData();
    assertEquals(3, units.size());

    assertUnit(units.get(0), "A", -520, 25);
    assertUnit(units.get(1), "A2", -220, 25);
    assertUnit(units.get(2), "A1", -200, 0);
  }
Exemplo n.º 2
0
 public void test_should_calculate_correct_report_with_multiple_currencies_1() {
   // A  -120$
   //    -100$$
   RateBuilder.withDb(db).at(DateTime.today()).from(c2).to(c1).rate(0.1f).create();
   TransactionBuilder.withDb(db)
       .account(a1)
       .category(categories.get("A"))
       .dateTime(DateTime.today())
       .amount(-120)
       .create();
   TransactionBuilder.withDb(db)
       .account(a3)
       .category(categories.get("A"))
       .dateTime(DateTime.today())
       .amount(-100)
       .create();
   List<GraphUnit> units = assertReportReturnsData();
   assertName(units.get(0), "A");
   assertExpense(units.get(0), -130);
   assertIncome(units.get(0), 0);
 }