Examples of ExchangeRate


Examples of com.drighetto.easymock.ExchangeRate

   * @throws java.lang.Exception
   */
  @Test
  public void test01() throws Exception {
    // Define a exchange rate provider with a mock
    ExchangeRate exchangeRateMock = EasyMock.createMock(ExchangeRate.class);
    // Define what is expected to valid the test (configure the mock object
    // created above)
    EasyMock.expect(exchangeRateMock.getRate("USD", "EUR")).andReturn(1.5);
    // Initialize the mock object before to use it
    EasyMock.replay(exchangeRateMock);
    // Define a reference object to valid the test
    Currency cRefObj = new Currency(3.75, "EUR");
    // Define a test object
View Full Code Here

Examples of com.drighetto.easymock.ExchangeRate

  @Test
  public void test02() throws Exception {
    // Define a exchange rate provider with a mock, we use the
    // "createStrictMock()" method to activate the method call order
    // checking
    ExchangeRate exchangeRateMock = EasyMock.createStrictMock(ExchangeRate.class);
    // Define what is expected to valid the test (configure the mock object
    // created above)
    EasyMock.expect(exchangeRateMock.getRate("USD", "EUR")).andReturn(1.5);
    // Define that the "getRate()" method must call exactly one time !
    EasyMock.expectLastCall().once();
    // Initialize the mock object before to use it
    EasyMock.replay(exchangeRateMock);
    // Define a reference object to valid the test
View Full Code Here

Examples of com.drighetto.easymock.ExchangeRate

  @Test
  public void test03() throws Exception {
    // Define a exchange rate provider with a mock, we use the
    // "createStrictMock()" method to activate the method call order
    // checking
    ExchangeRate exchangeRateMock = EasyMock.createStrictMock(ExchangeRate.class);
    // Define what is expected to valid the test (configure the mock object
    // created above), we set that method "getRate()" can be call with any
    // not null String parameter value and will always return "1.5" value
    EasyMock.expect(exchangeRateMock.getRate((String) EasyMock.notNull(), (String) EasyMock.notNull())).andReturn(1.5);
    // Define that the "getRate()" method must call exactly one time !
    EasyMock.expectLastCall().once();
    // Initialize the mock object before to use it
    EasyMock.replay(exchangeRateMock);
    // Define a reference object to valid the test
View Full Code Here

Examples of com.drighetto.easymock.ExchangeRate

   * @throws java.lang.Exception
   */
  @Test
  public void test04() throws IOException {
    // Define a exchange rate provider with a mock
    ExchangeRate exchangeRateMock = EasyMock.createMock(ExchangeRate.class);
    // Define what is expected to valid the test (configure the mock object
    // created above), we set that method "getRate()" can be call with any
    // String parameter value for the second parameter and NULL for the
    // first and will always throw a IOException
    // (and thus the method result will be always NULL)
    EasyMock.expect(exchangeRateMock.getRate((String) EasyMock.isNull(), (String) EasyMock.anyObject())).andThrow(new IOException());
    // Initialize the mock object before to use it
    EasyMock.replay(exchangeRateMock);
    // Define a test object
    Currency cTestObj = new Currency(2.50, null);
    // Run the test using the mock as exchange rate provider
View Full Code Here

Examples of com.suarte.core.ExchangeRate

    public String edit() {
        local = currencyManager.findLocal();
        if (id != null) {
            exchangeRate = exchangeRateManager.get(id);
        } else {
            exchangeRate = new ExchangeRate();
            exchangeRate.setFromCurrency(local);
        }

        return "edit";
    }
View Full Code Here

Examples of com.suarte.core.ExchangeRate

        return "edit";
    }

    public String add() {
        local = currencyManager.findLocal();
        exchangeRate = new ExchangeRate();
        exchangeRate.setFromCurrency(local);

        return "add";
    }
View Full Code Here

Examples of org.jquantlib.currencies.ExchangeRate

        final Money m2 = Money.multiple(100000.0 , EUR);
        final Money m3 = Money.multiple(500000.0 , USD);


        ExchangeRateManager.getInstance().clear();
        final ExchangeRate eur_usd = new  ExchangeRate(EUR, USD, 1.2042);
        final ExchangeRate eur_gbp = new ExchangeRate(EUR, GBP, 0.6612);
        ExchangeRateManager.getInstance().add(eur_usd);
        ExchangeRateManager.getInstance().add(eur_gbp);


        Money.conversionType = Money.ConversionType.BaseCurrencyConversion;
        Money.baseCurrency = EUR;

        //divided the steps for tracing...
        final Money calculated0 = m1.mul(3.0);
        final Money calculated1 = (m2.mul(2.5));
        final Money calculated2 = m3.div(5.0);

        final Money calculated3 = calculated0.add(calculated1).sub(calculated2);

        QL.info("Calculated value: " + calculated3.value());


        final Rounding round = Money.baseCurrency.rounding();
        /*@Decimal*/final double x = round.operator(m1.value()*3.0/eur_gbp.rate()) + 2.5*m2.value() -
        round.operator(m3.value()/(5.0*eur_usd.rate()));
        QL.info("Expected value: " + x);

        final Money expected = new Money(x, EUR);

View Full Code Here

Examples of project.gluebooster.applications.assetManagement.fields.ExchangeRate

   
    SecuritiesInformation info = new SecuritiesInformation();
    info.setPriceNotation(new BigDecimal(1));
    SecuritiesMarketPrice marketPrice = new SecuritiesMarketPrice();
    SecuritiesCurrentMarketPrice currentMarketPrice = new SecuritiesCurrentMarketPrice();
    ExchangeRate euro = new ExchangeRate();
    euro.setRate(new BigDecimal(1));
    euro.setSourceCurrency("EUR");
    euro.setTargetCurrency("EUR");
    ArrayList<ExchangeRate> rates = new ArrayList<ExchangeRate>();
    rates.add(euro);
    ExchangeRateManager exchangeRate = new ExchangeRateManager(rates, "EUR");
   
    MessageToWriterTransformer systemErrWriter = new MessageToWriterTransformer(System.err);
View Full Code Here

Examples of project.gluebooster.applications.assetManagement.fields.ExchangeRate

   
    SecuritiesInformation info = new SecuritiesInformation();
    info.setPriceNotation(new BigDecimal(1));
    SecuritiesMarketPrice marketPrice = new SecuritiesMarketPrice();
    SecuritiesCurrentMarketPrice currentMarketPrice = new SecuritiesCurrentMarketPrice();
    ExchangeRate euro = new ExchangeRate();
    euro.setRate(new BigDecimal(1));
    euro.setSourceCurrency("EUR");
    euro.setTargetCurrency("EUR");
    ExchangeRate cad = new ExchangeRate();
    cad.setRate(new BigDecimal(2));
    cad.setSourceCurrency("EUR");
    cad.setTargetCurrency("CAD");
    ArrayList<ExchangeRate> rates = new ArrayList<ExchangeRate>();
    rates.add(euro);
    rates.add(cad);
    ExchangeRateManager exchangeRate = new ExchangeRateManager(rates, "EUR");
   
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.