Package whitewerx.com.trapos.translators

Examples of whitewerx.com.trapos.translators.RateTranslator


    public MarketRateEventHandler(RateTranslator translator) {
        this.translator = translator;
    }
   
    public MarketRateEventHandler() {
        this(new RateTranslator());
    }
View Full Code Here


    @Test
    public void translatesValidEURUSDRate() throws Exception {
        String delimitedRate = "R|EURUSD|1.3124";
        Rate expected = new Rate(1.3124, EURUSD);
               
        RateTranslator rateTranslator = new RateTranslator();
        Rate rate = rateTranslator.translate(delimitedRate);
        assertThat(rate, equalTo(expected));
    }
View Full Code Here

   
    @Test(expected=TranslateException.class)
    public void shouldNotTranslateInvalidEURUSDRate() throws Exception {
        String invalidRate = "1.3123|EURUSD";
               
        RateTranslator rateTranslator = new RateTranslator();
        rateTranslator.translate(invalidRate);
    }
View Full Code Here

    @Test
    public void shouldTransalateRateMessages(){
        String delimitedRate = "R";
       
        RateTranslator rateTranslator = new RateTranslator();
        assertThat(rateTranslator.canHandle(delimitedRate), equalTo(true));
    }
View Full Code Here

   
    @Test
    public void shouldNotTranslateAnyOtherMessageTypes(){
        String otherMessageType = "C";
       
        RateTranslator rateTranslator = new RateTranslator();
        assertThat(rateTranslator.canHandle(otherMessageType), equalTo(false));
    }
View Full Code Here

   
    @Test
    public void consumesRateEvent() throws Exception {
       
        final String delimitedRate = "R|GBPUSD|1.6324";
        final RateTranslator rateTranslator = context.mock(RateTranslator.class);
        final MarketEvent marketEvent = context.mock(MarketEvent.class);
        final Rate rate = context.mock(Rate.class);
       
        final MarketRateEventHandler h = new MarketRateEventHandler(rateTranslator);
        context.checking(new Expectations(){{
View Full Code Here

   
    @Test
    public void shouldNotConsumeTradeEvents() throws Exception {
        final String delimitedTrade = "T|S|2.3m|R|GBPUSD|1.6324";
       
        final RateTranslator rateTranslator = context.mock(RateTranslator.class);
        final MarketEvent marketEvent = context.mock(MarketEvent.class);
       
        final MarketRateEventHandler h = new MarketRateEventHandler(rateTranslator);
        context.checking(new Expectations(){{
            oneOf(marketEvent).getMessage();
View Full Code Here

TOP

Related Classes of whitewerx.com.trapos.translators.RateTranslator

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.