Package com.wesabe.xmlson

Examples of com.wesabe.xmlson.XmlsonObject


      when(txaction.getTaggedAmounts()).thenReturn(ImmutableList.of(taggedAmount));
    }

    @Test
    public void itHasAnArrayOfTaggedAmounts() throws Exception {
      final XmlsonObject representation = presenter.present(txaction, Locale.UK);

      final XmlsonArray tags = (XmlsonArray) representation.get("tags");
      assertThat(tags.getMembers().size(), is(1));

      final XmlsonObject tag = (XmlsonObject) tags.getMembers().get(0);
      assertThat(tag, is(taggedAmountRepresentation));

      verify(taggedAmountPresenter).present(this.taggedAmount, Locale.UK);
    }
View Full Code Here


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

      assertThat(representation.getInteger("id"), is(200498));
    }
   
    @Test
    public void itHasAUri() throws Exception {
      final XmlsonObject envelope = presenter.present(txaction, Locale.UK);
      final XmlsonObject representation = (XmlsonObject) envelope.get("transfer");
     
      assertThat(representation.getString("uri"), is("/transactions/200498"));
    }
View Full Code Here

      assertThat(representation.getString("uri"), is("/transactions/200498"));
    }
   
    @Test
    public void itHasABriefAccountRepresentation() throws Exception {
      final XmlsonObject envelope = presenter.present(txaction, Locale.UK);
      final XmlsonObject representation = (XmlsonObject) envelope.get("transfer");
     
      assertThat(representation.get("account"), is((XmlsonElement) accountRepresentation));
     
      verify(accountPresenter, atLeastOnce()).present(account);
    }
View Full Code Here

      verify(accountPresenter, atLeastOnce()).present(account);
    }
   
    @Test
    public void itHasTheDatePosted() throws Exception {
      final XmlsonObject envelope = presenter.present(txaction, Locale.UK);
      final XmlsonObject representation = (XmlsonObject) envelope.get("transfer");
     
      assertThat(representation.getString("date"), is("20080905"));
    }
View Full Code Here

      assertThat(representation.getString("date"), is("20080905"));
    }
   
    @Test
    public void itHasTheOriginalDatePosted() throws Exception {
      final XmlsonObject envelope = presenter.present(txaction, Locale.UK);
      final XmlsonObject representation = (XmlsonObject) envelope.get("transfer");
     
      assertThat(representation.getString("original-date"), is("20080908"));
    }
View Full Code Here

      assertThat(representation.getString("original-date"), is("20080908"));
    }
   
    @Test
    public void itHasTheAmount() throws Exception {
      final XmlsonObject envelope = presenter.present(txaction, Locale.UK);
      final XmlsonObject representation = (XmlsonObject) envelope.get("transfer");
     
      final XmlsonObject amount = (XmlsonObject) representation.get("amount");
      assertThat(amount.getString("display"), is("$33.40"));
      assertThat(amount.getString("value"), is("33.40"));
    }
View Full Code Here

      assertThat(amount.getString("value"), is("33.40"));
    }
   
    @Test
    public void itHasAnUneditedName() throws Exception {
      final XmlsonObject envelope = presenter.present(txaction, Locale.UK);
      final XmlsonObject representation = (XmlsonObject) envelope.get("transfer");
     
      assertThat(representation.getString("unedited-name"), is("BLAH"));
    }
View Full Code Here

      assertThat(representation.getString("unedited-name"), is("BLAH"));
    }
   
    @Test
    public void itHasANote() throws Exception {
      final XmlsonObject envelope = presenter.present(txaction, Locale.UK);
      final XmlsonObject representation = (XmlsonObject) envelope.get("transfer");
     
      assertThat(representation.getString("note"), is("Another thing."));
    }
View Full Code Here

      assertThat(representation.getString("note"), is("Another thing."));
    }
   
    @Test
    public void itHasAnEmptyArrayOfTags() throws Exception {
      final XmlsonObject envelope = presenter.present(txaction, Locale.UK);
      final XmlsonObject representation = (XmlsonObject) envelope.get("transfer");
     
      final XmlsonArray tags = (XmlsonArray) representation.get("tags");
      assertThat(tags.getMembers().size(), is(0));
    }
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.