Package com.wesabe.xmlson

Examples of com.wesabe.xmlson.XmlsonObject


      this.presenter = new FinancialInstPresenter();     
    }
   
    @Test
    public void itHasTheName() throws Exception {
      final XmlsonObject representation = presenter.present(financialInst);
     
      assertThat(representation.getString("name"), is("My CU"));
    }
View Full Code Here


      assertThat(representation.getString("name"), is("My CU"));
    }
   
    @Test
    public void itHasTheId() throws Exception {
      final XmlsonObject representation = presenter.present(financialInst);
     
      assertThat(representation.getString("id"), is("us-123456"));
    }
View Full Code Here

      );
    }
   
    @Test
    public void itItNamedNetWorthSummary() throws Exception {
      final XmlsonObject representation = presenter.present(data, Locale.CANADA_FRENCH);
     
      assertThat(representation.getName()).isEqualTo("net-worth-summary");
    }
View Full Code Here

      assertThat(representation.getName()).isEqualTo("net-worth-summary");
    }
   
    @Test
    public void itItHasSummaries() throws Exception {
      final XmlsonObject representation = presenter.present(data, Locale.CANADA_FRENCH);
     
      final XmlsonArray summaries = (XmlsonArray) representation.get("summaries");
      assertThat(summaries.getMembers()).hasSize(1);
     
      final XmlsonObject summary = (XmlsonObject) summaries.getMembers().get(0);
      assertThat(summary.getName()).isEqualTo("summary");
      assertThat(((XmlsonObject) summary.get("interval")).getString("start")).isEqualTo("20070101");
      assertThat(((XmlsonObject) summary.get("interval")).getString("end")).isEqualTo("20070201");
      assertThat(((XmlsonObject) summary.get("balance")).getString("display")).isEqualTo("400,00 $ US");
      assertThat(((XmlsonObject) summary.get("balance")).getString("value")).isEqualTo("400.00");
    }
View Full Code Here

      when(taggedAmount.isSplit()).thenReturn(false);
    }
   
    @Test
    public void itIsNamedTag() throws Exception {
      final XmlsonObject representation = presenter.present(taggedAmount, Locale.ITALY);
      assertThat(representation.getName(), is("tag"));
    }
View Full Code Here

      assertThat(representation.getName(), is("tag"));
    }
   
    @Test
    public void itHasAUri() throws Exception {
      final XmlsonObject representation = presenter.present(taggedAmount, Locale.ITALY);
     
      assertThat(representation.getString("uri"), is("/tags/food"));
    }
View Full Code Here

      when(taggedAmount.isSplit()).thenReturn(true);
    }
   
    @Test
    public void itHasAnAmountInTheGivenLocale() throws Exception {
      final XmlsonObject representation = presenter.present(taggedAmount, Locale.ITALY);
     
      final XmlsonObject amount = (XmlsonObject) representation.get("amount");
      assertThat(amount.getString("display"), is("-US$ 34,40"));
      assertThat(amount.getString("value"), is("-34.40"));
    }
View Full Code Here

      );
    }
   
    @Test
    public void itItNamedTagSummary() throws Exception {
      final XmlsonObject representation = presenter.present(ImmutableMap.of(tag, summary), Locale.CANADA_FRENCH);
     
      assertThat(representation.getName(), is("tag-summary"));
    }
View Full Code Here

      assertThat(representation.getName(), is("tag-summary"));
    }
   
    @Test
    public void itHasAnArrayOfSummaries() throws Exception {
      final XmlsonObject representation = presenter.present(ImmutableMap.of(tag, summary), Locale.CANADA_FRENCH);
      final XmlsonArray summaries = (XmlsonArray) representation.get("summaries");
     
      assertThat(summaries.getMembers().size(), is(1));
    }
View Full Code Here

      assertThat(summaries.getMembers().size(), is(1));
    }
   
    @Test
    public void itHasTheSpendingDataForEachSummary() throws Exception {
      final XmlsonObject representation = presenter.present(ImmutableMap.of(tag, summary), Locale.CANADA_FRENCH);
      final XmlsonArray summaries = (XmlsonArray) representation.get("summaries");
      final XmlsonObject summary = (XmlsonObject) summaries.getMembers().get(0);
     
      assertThat(summary.getName(), is("summary"));
     
      final XmlsonObject spending = (XmlsonObject) summary.get("spending");
     
      assertThat(spending.getInteger("count"), is(17));
      assertThat(spending.getString("value"), is("3409.32"));
      assertThat(spending.getString("display"), is("3 409,32 $ US"));
    }
View Full Code Here

TOP

Related Classes of com.wesabe.xmlson.XmlsonObject

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.