@Test public void itHasATotal() throws Exception { final XmlsonObject representation = presenter.present(accounts, USD, Locale.PRC); final XmlsonObject total = (XmlsonObject) representation.get("total"); assertThat(total.getName(), is("total")); verify(accounts).getTotal(USD, exchangeRateMap); verify(moneyPresenter).present("total", money("3460.81", USD), Locale.PRC); }
@Test public void itHasAnArrayOfAccounts() throws Exception { final XmlsonObject representation = presenter.present(accounts, USD, Locale.PRC); final XmlsonArray accounts = (XmlsonArray) representation.get("accounts"); assertThat(accounts.getMembers().size(), is(1)); final XmlsonObject account = (XmlsonObject) accounts.getMembers().get(0); assertThat(account.getName(), is("account")); verify(accountPresenter).present(this.account, Locale.PRC); }
@Test public void itHasAnArrayOfGroups() throws Exception { final XmlsonObject representation = presenter.present(accounts, USD, Locale.PRC); final XmlsonArray groups = (XmlsonArray) representation.get("account-groups"); assertThat(groups.getMembers().size(), is(1)); final XmlsonObject group = (XmlsonObject) groups.getMembers().get(0); assertThat(group.getName(), is("group")); verify(accountGroupPresenter).present(this.group, USD, Locale.PRC); }
@Test public void itIsNamedAccountList() throws Exception { final XmlsonObject representation = presenter.present(accounts, USD, Locale.PRC); assertThat(representation.getName(), is("account-list")); }