Package com.wesabe.api.accounts.analytics.TagHierarchy

Examples of com.wesabe.api.accounts.analytics.TagHierarchy.Node


            assertThat(fee.getChildren()).isEmpty();
        }

        @Test
        public void itCountsCashAsARootTag() throws Exception {
            final Node cash = hierarchy.getChildren().get(tag("cash"));
            assertThat(cash.getSum().getAmount()).isEqualTo(money("100.00", USD));
            assertThat(cash.getSum().getCount()).isEqualTo(1);

            assertThat(cash.getChildren()).isEmpty();
        }
View Full Code Here


            assertThat(cash.getChildren()).isEmpty();
        }

        @Test
        public void itCountsFoodAsARootTag() throws Exception {
            final Node food = hierarchy.getChildren().get(tag("food"));
            assertThat(food.getSum().getAmount()).isEqualTo(money("400.00", USD));
            assertThat(food.getSum().getCount()).isEqualTo(1);

            assertThat(food.getChildren()).hasSize(1);
        }
View Full Code Here

            assertThat(food.getChildren()).hasSize(1);
        }

        @Test
        public void itCountsGroceriesUnderTheFoodTag() throws Exception {
            final Node food = hierarchy.getChildren().get(tag("food"));
            final Node groceries = food.getChildren().get(tag("groceries"));

            assertThat(groceries.getSum().getAmount()).isEqualTo(money("400.00", USD));
            assertThat(groceries.getSum().getCount()).isEqualTo(1);

            assertThat(groceries.getChildren()).isEmpty();
        }
View Full Code Here

   
    @Test
    public void itPlacesUntaggedTransactionsInTheirOwnCategory() throws Exception {
      assertThat(hierarchy.getChildren().keySet()).containsOnly(TagHierarchyBuilder.UNTAGGED);
     
      final Node untagged = hierarchy.getChildren().get(TagHierarchyBuilder.UNTAGGED);
      assertThat(untagged.getSum().getCount()).isEqualTo(3);
      assertThat(untagged.getSum().getAmount()).isEqualTo(money("703.50", USD));
    }
View Full Code Here

      );
    }
   
    @Test
    public void itConvertsOtherCurrenciesIntoTheTargetCurrency() throws Exception {
      final Node rent = hierarchy.getChildren().get(tag("rent"));
      assertThat(rent.getSum().getAmount()).isEqualTo(money("299.98", USD));
      assertThat(rent.getSum().getCount()).isEqualTo(1);
      assertThat(rent.getChildren()).isEmpty();
    }
View Full Code Here

    public void setup() throws Exception {
      this.moneyPresenter = new MoneyPresenter();
      this.sumOfMoneyPresenter = new SumOfMoneyPresenter(moneyPresenter);
      this.presenter = new TagHierarchyPresenter(sumOfMoneyPresenter);
     
      this.restaurants = new Node(tag("restaurants"), new SumOfMoney(money("20.00", USD), 1), ImmutableList.<Node>of());
      this.groceries = new Node(tag("groceries"), new SumOfMoney(money("30.00", USD), 1), ImmutableList.<Node>of());
      this.food = new Node(tag("food"), new SumOfMoney(money("50.00", USD), 2), ImmutableList.of(restaurants, groceries));
      this.entertainment = new Node(tag("entertainment"), new SumOfMoney(money("50.00", USD), 1), ImmutableList.<Node>of());
     
      this.hierarchy = new TagHierarchy(ImmutableList.of(food, entertainment), new SumOfMoney(money("100.00", USD), 3));
    }
View Full Code Here

      );
    }
   
    @Test
    public void itUsesFoodAsATopTag() throws Exception {
      final Node food = hierarchy.getChildren().get(tag("food"));
      assertThat(food.getSum().getAmount()).isEqualTo(money("1000.00", USD));
      assertThat(food.getSum().getCount()).isEqualTo(4);
    }
View Full Code Here

      assertThat(food.getSum().getCount()).isEqualTo(4);
    }
   
    @Test
    public void itNestsTheFancyTagUnderFood() throws Exception {
      final Node food = hierarchy.getChildren().get(tag("food"));
      final Node fancy = food.getChildren().get(tag("fancy"));
      assertThat(fancy.getSum().getAmount()).isEqualTo(money("300.00", USD));
      assertThat(fancy.getSum().getCount()).isEqualTo(1);
      assertThat(fancy.getChildren()).isEmpty();
    }
View Full Code Here

      assertThat(fancy.getChildren()).isEmpty();
    }
   
    @Test
    public void itNestsTheGroceriesTagtUnderFood() throws Exception {
      final Node food = hierarchy.getChildren().get(tag("food"));
      final Node groceries = food.getChildren().get(tag("groceries"));
      assertThat(groceries.getSum().getAmount()).isEqualTo(money("600.00", USD));
      assertThat(groceries.getSum().getCount()).isEqualTo(2);
      assertThat(groceries.getChildren()).isEmpty();
    }
View Full Code Here

      assertThat(groceries.getChildren()).isEmpty();
    }
   
    @Test
    public void itNestsTheItalianTagtUnderFood() throws Exception {
      final Node food = hierarchy.getChildren().get(tag("food"));
      final Node italian = food.getChildren().get(tag("italian"));
      assertThat(italian.getSum().getAmount()).isEqualTo(money("100.00", USD));
      assertThat(italian.getSum().getCount()).isEqualTo(1);
      assertThat(italian.getChildren()).isEmpty();
    }
View Full Code Here

TOP

Related Classes of com.wesabe.api.accounts.analytics.TagHierarchy.Node

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.