Package com.wesabe.api.util.money

Examples of com.wesabe.api.util.money.CurrencyExchangeRateMap$CurrencyToCurrencyToDateToRateMap


   
    private CurrencyExchangeRateMap rates;

    @Before
    public void setRates() {
      this.rates = new CurrencyExchangeRateMap();
      this.rates.addExchangeRate(USD, EUR, jun14th, lowDollarToEuroRate);
      this.rates.addExchangeRate(USD, EUR, jun17th, highDollarToEuroRate);
    }
View Full Code Here


   
    @Test
    public void itThrowsAnUnknownCurrencyCodeException() throws Exception {
      boolean exceptionThrown = false;
      try {
        taggedAmount.getConvertedAmount(GBP, new CurrencyExchangeRateMap());
      } catch (UnknownCurrencyCodeException e) {
        exceptionThrown = true;
        assertEquals("!!!", e.getCurrencyCode());
      }
      assertTrue(exceptionThrown);
View Full Code Here

      assertThat(taggedAmount.isSplit(), is(true));
    }
   
    @Test
    public void itIsConvertableToOtherCurrencies() throws Exception {
      CurrencyExchangeRateMap exchangeRates = new CurrencyExchangeRateMap();
      exchangeRates.addExchangeRate(USD, EUR, jun14th, decimal("0.69"));
      exchangeRates.addExchangeRate(USD, EUR, jun15th, decimal("1.50"));
      exchangeRates.addExchangeRate(USD, EUR, jun16th, decimal("0.90"));
     
      assertEquals(money("60.00", EUR), taggedAmount.getConvertedAmount(EUR, exchangeRates));
    }
View Full Code Here

      assertTrue(zeroDollars.equals(zeroDollars.negate()));
    }

    @Test
    public void shouldBeZeroEurosWhenConverted() throws Exception {
      CurrencyExchangeRateMap exchangeRates = new CurrencyExchangeRateMap();
      Money zeroDollars = new Money(decimal("0.00"), USD);
      Money zeroEuros = new Money(decimal("0.00"), EUR);
      assertEquals(zeroEuros, zeroDollars.convert(exchangeRates, EUR, now()));
    }
View Full Code Here

   
    @Test
    public void itThrowsAnUnknownCurrencyCodeExceptionWhenConvertingTheAmount() throws Exception {
      boolean exceptionThrown = false;
      try {
        txaction.getConvertedAmount(GBP, new CurrencyExchangeRateMap());
      } catch (UnknownCurrencyCodeException e) {
        exceptionThrown = true;
        assertEquals("!!!", e.getCurrencyCode());
      }
      assertTrue(exceptionThrown);
View Full Code Here

      assertFalse(txaction.isDisabled());
    }
   
    @Test
    public void itIsConvertableToOtherCurrencies() throws Exception {
      final CurrencyExchangeRateMap exchangeRates = new CurrencyExchangeRateMap();
      exchangeRates.addExchangeRate(EUR, USD, jun14th, decimal("0.69"));
      exchangeRates.addExchangeRate(EUR, USD, jun15th, decimal("1.50"));
      exchangeRates.addExchangeRate(EUR, USD, jun16th, decimal("0.90"));
     
      assertEquals(money("-51.33", USD), txaction.getConvertedAmount(USD, exchangeRates));
    }
View Full Code Here

  }

  public static class One_Dollar_Converted_Into_Dollars {
    @Test
    public void shouldBeOneDollar() throws Exception {
      CurrencyExchangeRateMap exchangeRates = new CurrencyExchangeRateMap();
      Money oneDollar = new Money(decimal("1.00"), USD);
      assertEquals(oneDollar, oneDollar.convert(exchangeRates, USD, now()));
    }
View Full Code Here

      deletedLunch.addTag(food);
      deletedLunch.addTag(restaurants);
      deletedLunch.addTag(friends, decimal("-6.45"));
      deletedLunch.setStatus(TxactionStatus.DELETED);
     
      final TagSummarizer summarizer = new TagSummarizer(new CurrencyExchangeRateMap());
     
      this.summaries = summarizer.summarize(txactions, USD);
    }
View Full Code Here

TOP

Related Classes of com.wesabe.api.util.money.CurrencyExchangeRateMap$CurrencyToCurrencyToDateToRateMap

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.