Package com.wesabe.api.util.money

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


    protected TagSummarizer summarizer;
    protected TagHierarchy hierarchy;
   
   
    protected void setup() throws Exception {
      this.exchangeRateMap = new CurrencyExchangeRateMap();
      this.summarizer = new TagSummarizer(exchangeRateMap);
      this.builder = new TagHierarchyBuilder(summarizer, exchangeRateMap);
    }
View Full Code Here


  }

  public static class One_Dollar_Converted_Into_Euros {
    @Test
    public void shouldBeWhateverTheExchangeRateIs() throws Exception {
      CurrencyExchangeRateMap exchangeRates = new CurrencyExchangeRateMap();
      exchangeRates.addExchangeRate(USD, EUR, now(), decimal("0.79"));
      Money oneDollar = new Money(decimal("1.00"), USD);
      Money wayLessInEuros = new Money(decimal("0.79"), EUR);
      Money actualValue = oneDollar.convert(exchangeRates, EUR, now());
      assertEquals(wayLessInEuros, actualValue);
    }
View Full Code Here

      assertEquals(wayLessInEuros, actualValue);
    }

    @Test
    public void shouldRoundDownIfLessThanHalf() throws Exception {
      CurrencyExchangeRateMap exchangeRates = new CurrencyExchangeRateMap();
      exchangeRates.addExchangeRate(USD, EUR, now(), decimal("0.794"));
      Money oneDollar = new Money(decimal("1.00"), USD);
      Money wayLessInEuros = new Money(decimal("0.79"), EUR);
      Money actualValue = oneDollar.convert(exchangeRates, EUR, now());
      assertEquals(wayLessInEuros, actualValue);
    }
View Full Code Here

      assertEquals(wayLessInEuros, actualValue);
    }

    @Test
    public void shouldRoundUpIfHalf() throws Exception {
      CurrencyExchangeRateMap exchangeRates = new CurrencyExchangeRateMap();
      exchangeRates.addExchangeRate(USD, EUR, now(), decimal("0.795"));
      Money oneDollar = new Money(decimal("1.00"), USD);
      Money wayLessInEuros = new Money(decimal("0.80"), EUR);
      Money actualValue = oneDollar.convert(exchangeRates, EUR, now());
      assertEquals(wayLessInEuros, actualValue);
    }
View Full Code Here

      assertEquals(wayLessInEuros, actualValue);
    }

    @Test
    public void shouldRoundUpIfMoreThanHalf() throws Exception {
      CurrencyExchangeRateMap exchangeRates = new CurrencyExchangeRateMap();
      exchangeRates.addExchangeRate(USD, EUR, now(), decimal("0.797"));
      Money oneDollar = new Money(decimal("1.00"), USD);
      Money wayLessInEuros = new Money(decimal("0.80"), EUR);
      Money actualValue = oneDollar.convert(exchangeRates, EUR, now());
      assertEquals(wayLessInEuros, actualValue);
    }
View Full Code Here

      assert(txactionList.isEmpty());
    }
   
    @Test
    public void itIsStillEmptyAfterCalculatingRunningTotalBalances() {
      txactionList.calculateRunningTotalBalances(new ArrayList<Account>(), USD, new CurrencyExchangeRateMap());
    }
View Full Code Here

    }
  }
 
  public static CurrencyExchangeRateMap singleRateMap(Currency source,
      Currency target, DateTime date, BigDecimal rate) {
    CurrencyExchangeRateMap map = new CurrencyExchangeRateMap();
    map.addExchangeRate(source, target, date, rate);
    return map;
  }
View Full Code Here

  public static class Getting_An_Identity_Rate {
    private CurrencyExchangeRateMap rates;
   
    @Before
    public void setRates() {
      this.rates = new CurrencyExchangeRateMap();
    }
View Full Code Here

    private CurrencyExchangeRateMap rates;
   

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

   
    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

TOP

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

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.