Package com.wesabe.api.accounts.entities

Examples of com.wesabe.api.accounts.entities.Txaction


    @Before
    public void setup() {
      final Account account = new Account("Checking", USD);

      final Txaction txaction = new Txaction(account, decimal("-30.00"), date(2009, 2, 13));
      txaction.setStatus(TxactionStatus.DELETED);

      final IntervalSummarizer summarizer = new IntervalSummarizer(new CurrencyExchangeRateMap());

      this.summaries = summarizer.summarize(ImmutableList.of(txaction), interval, IntervalType.MONTHLY, USD, null);
    }
View Full Code Here


    @Before
    public void setup() {
      final Account account = new Account("Checking", USD);

      final Txaction txaction = new Txaction(account, decimal("-30.00"), date(2009, 2, 13));
      txaction.setStatus(TxactionStatus.DISABLED);

      final IntervalSummarizer summarizer = new IntervalSummarizer(new CurrencyExchangeRateMap());

      this.summaries = summarizer.summarize(ImmutableList.of(txaction), interval, IntervalType.MONTHLY, USD, null);
    }
View Full Code Here

    private ImmutableMap<Interval,MonetarySummaryWithSplits> summaries;

    @Before
    public void setup() {
      final Account account = new Account("Checking", USD);
      final Txaction txaction = new Txaction(account, decimal("-30.00"), date(2009, 2, 13));
      txaction.setTransferTxaction(new Txaction());

      final IntervalSummarizer summarizer = new IntervalSummarizer(new CurrencyExchangeRateMap());

      this.summaries = summarizer.summarize(ImmutableList.of(txaction), interval, IntervalType.MONTHLY, USD, null);
    }
View Full Code Here

    private ImmutableMap<Interval,MonetarySummaryWithSplits> summaries;

    @Before
    public void setup() {
      final Account account = new Account("Checking", USD);
      final Txaction txaction1 = new Txaction(account, decimal("-30.00"), date(2009, 2, 13));
      final Txaction txaction2 = new Txaction(account, decimal("-30.00"), date(2009, 2, 14));

      final IntervalSummarizer summarizer = new IntervalSummarizer(new CurrencyExchangeRateMap());

      this.summaries = summarizer.summarize(ImmutableList.of(txaction1, txaction2), interval, IntervalType.MONTHLY, USD, null);
    }
View Full Code Here

    private ImmutableMap<Interval,MonetarySummaryWithSplits> summaries;

    @Before
    public void setup() {
      final Account account = new Account("Checking", USD);
      final Txaction txaction = new Txaction(account, decimal("-30.00"), date(2009, 2, 13));
      txaction.addTag(new Tag("food"));

      final IntervalSummarizer summarizer = new IntervalSummarizer(new CurrencyExchangeRateMap());
      this.summaries = summarizer.summarize(ImmutableList.of(txaction), interval, IntervalType.MONTHLY, USD, null);
    }
View Full Code Here

    private ImmutableMap<Interval,MonetarySummaryWithSplits> summaries;

    @Before
    public void setup() {
      final Account account = new Account("Checking", USD);
      final Txaction fullyFiltered = new Txaction(account, decimal("-30.00"), date(2009, 3, 13));
      fullyFiltered.addTag(workExpense);

      final Txaction partiallyFiltered = new Txaction(account, decimal("-30.00"), date(2009, 2, 13));
      partiallyFiltered.addTag(loan, decimal("-20.00"));

      final IntervalSummarizer summarizer = new IntervalSummarizer(new CurrencyExchangeRateMap());

      this.summaries = summarizer.summarize(ImmutableList.of(fullyFiltered, partiallyFiltered), interval, IntervalType.MONTHLY, USD, filteredTags);
    }
View Full Code Here

      inject(Txaction.class, txaction, "createdAt", jun15th);
    }

    @Test
    public void itComesBeforeAnotherTxactionOnALaterDate() {
      Txaction txactionWithLaterPostedDate = new Txaction(euroSavings, decimal("-34.22"), jun16th);
      assertEquals(-1, txaction.compareTo(txactionWithLaterPostedDate));
      assertEquals(1, txactionWithLaterPostedDate.compareTo(txaction));
    }
View Full Code Here

      assertEquals(1, txactionWithLaterPostedDate.compareTo(txaction));
    }
   
    @Test
    public void itComesBeforeAnotherTxactionOnTheSameDateWithALaterSequence() {
      Txaction txactionWithLaterSequenceNumber = new Txaction(euroSavings, decimal("-34.22"), jun15th);
      txactionWithLaterSequenceNumber.setSequence(txaction.getSequence()-1);
      assertEquals(-1, txaction.compareTo(txactionWithLaterSequenceNumber));
      assertEquals(1, txactionWithLaterSequenceNumber.compareTo(txaction));
    }
View Full Code Here

      assertEquals(1, txactionWithLaterSequenceNumber.compareTo(txaction));
    }
   
    @Test
    public void itIgnoresSequenceWhenOneOrBothTxactionsHaveNullSequences() throws Exception {
      Txaction txactionWithNullSequenceNumber = new Txaction(euroSavings, decimal("-34.22"), jun15th);
      txactionWithNullSequenceNumber.setSequence(null);
      inject(Txaction.class, txactionWithNullSequenceNumber, "createdAt", jun17th);
      assertEquals(-1, txaction.compareTo(txactionWithNullSequenceNumber));
      assertEquals(1, txactionWithNullSequenceNumber.compareTo(txaction));
    }
View Full Code Here

      assertEquals(1, txactionWithNullSequenceNumber.compareTo(txaction));
    }
   
    @Test
    public void itIgnoresCreatedAtDatesWhenOneOrBothTxactionsHaveNullCreatedAtDates() throws Exception {
      Txaction txactionWithNullCreatedAt = new Txaction(euroSavings, decimal("-34.22"), jun15th);
      inject(Txaction.class, txactionWithNullCreatedAt, "createdAt", null);
      assertEquals(0, txaction.compareTo(txactionWithNullCreatedAt));
      assertEquals(0, txactionWithNullCreatedAt.compareTo(txaction));
    }
View Full Code Here

TOP

Related Classes of com.wesabe.api.accounts.entities.Txaction

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.