Package com.wesabe.xmlson

Examples of com.wesabe.xmlson.XmlsonObject


      when(txaction.getTransferTxaction()).thenReturn(txaction);
    }
   
    @Test
    public void itHasATrueValueForTransfer() throws Exception {
      final XmlsonObject envelope = presenter.present(txaction, Locale.UK);
      final XmlsonBoolean representation = (XmlsonBoolean) envelope.get("transfer");
     
      assertThat(representation.getValue(), is(true));
    }
View Full Code Here


      this.sum = new SumOfMoney(money("32.54", USD), 20);
    }
   
    @Test
    public void itItHasTheGivenName() throws Exception {
      final XmlsonObject representation = presenter.present("dingo", sum, Locale.JAPAN);
     
      assertThat(representation.getName(), is("dingo"));
    }
View Full Code Here

      assertThat(representation.getName(), is("dingo"));
    }
   
    @Test
    public void itItHasTheSumsCount() throws Exception {
      final XmlsonObject representation = presenter.present("dingo", sum, Locale.JAPAN);
     
      assertThat(representation.getInteger("count"), is(20));
    }
View Full Code Here

      assertThat(representation.getInteger("count"), is(20));
    }
   
    @Test
    public void itItHasTheSumAsAFloat() throws Exception {
      final XmlsonObject representation = presenter.present("dingo", sum, Locale.JAPAN);
     
      assertThat(representation.getString("value"), is("32.54"));
    }
View Full Code Here

      assertThat(representation.getString("value"), is("32.54"));
    }
   
    @Test
    public void itItHasTheSumAsAMonetaryAmount() throws Exception {
      final XmlsonObject representation = presenter.present("dingo", sum, Locale.JAPAN);
     
      assertThat(representation.getString("display"), is("US$32.54"));
    }
View Full Code Here

    private final MoneyPresenter presenter = new MoneyPresenter();
    private final Money amount = money("-44.56", USD);
   
    @Test
    public void itUsesTheSpecifiedName() throws Exception {
      final XmlsonObject representation = presenter.present("amount", amount, Locale.GERMANY);
      assertThat(representation.getName(), is("amount"));
    }
View Full Code Here

      assertThat(representation.getName(), is("amount"));
    }
   
    @Test
    public void itIncludesTheAmountAsAFloatingPointNumberInStringForm() throws Exception {
      final XmlsonObject representation = presenter.present("amount", amount, Locale.GERMANY);
     
      assertThat(representation.getString("value"), is("-44.56"));
    }
View Full Code Here

      assertThat(representation.getString("value"), is("-44.56"));
    }
   
    @Test
    public void itIncludesTheAmountAsAMonetaryAmountFormattedInTheGivenLocale() throws Exception {
      final XmlsonObject representation = presenter.present("amount", amount, Locale.GERMANY);
     
      assertThat(representation.getString("display"), is("-44,56 $"));
    }
View Full Code Here

      this.hierarchy = new TagHierarchy(ImmutableList.of(food, entertainment), new SumOfMoney(money("100.00", USD), 3));
    }
   
    @Test
    public void itItIsNamedTagHierarchy() throws Exception {
      final XmlsonObject representation = presenter.present(hierarchy, Locale.CANADA_FRENCH);
     
      assertThat(representation.getName(), is("tag-hierarchy"));
    }
View Full Code Here

      assertThat(representation.getName(), is("tag-hierarchy"));
    }
   
    @Test
    public void itHasATopLevelSum() throws Exception {
      final XmlsonObject representation = presenter.present(hierarchy, Locale.CANADA_FRENCH);
     
      final XmlsonObject sum = (XmlsonObject) representation.get("sum");
     
      assertThat(sum.getString("display")).isEqualTo("100,00 $ US");
      assertThat(sum.getString("value")).isEqualTo("100.00");
      assertThat(sum.getInteger("count")).isEqualTo(3);
    }
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.