Package org.springframework.nanotrader.data.service

Examples of org.springframework.nanotrader.data.service.TradingService


  public static Long RESULT_COUNT  = new Long(1);
  public static String DATE = new SimpleDateFormat("yyyy-MM-dd").format(new Date(1329759342904l));
 
  @Bean
  public TradingService tradingService() {
    TradingService tradingService = Mockito.mock(TradingService.class);
    when(tradingService.findHolding(eq(100), eq(ACCOUNT_ID))).thenReturn(holding());
    when(tradingService.findHoldingsByAccountId(eq(ACCOUNT_ID),  any(Integer.class), any(Integer.class))).thenReturn(holdings());
    when(tradingService.findCountOfHoldingsByAccountId(eq(ACCOUNT_ID))).thenReturn(RESULT_COUNT);
    when(tradingService.findCountOfOrders(eq(ACCOUNT_ID) , any(String.class))).thenReturn(RESULT_COUNT);
    when(tradingService.updateHolding(any(Holding.class))).thenReturn(holding());
    when(tradingService.findAccountProfile(400)).thenReturn(accountProfile());
    when(tradingService.findAccountProfile(NOT_A_VALID_PROFILE)).thenReturn(null);
    when(tradingService.updateAccountProfile(any(Accountprofile.class), any(String.class))).thenReturn(accountProfile());
    when(tradingService.findOrder(eq(999), eq(ACCOUNT_ID))).thenReturn(order());
    when(tradingService.saveOrder(any(Order.class))).thenReturn(null);
    when(tradingService.saveAccountProfile(any(Accountprofile.class))).thenReturn(accountProfile());
    when(tradingService.updateOrder(any(Order.class))).thenReturn(null);
    when(tradingService.findOrdersByStatus(eq(ACCOUNT_ID), any(String.class), any(Integer.class), any(Integer.class))).thenReturn(orders());
    when(tradingService.findOrders(eq(ACCOUNT_ID), any(Integer.class), any(Integer.class))).thenReturn(orders());
    when(tradingService.findQuoteBySymbol(eq(SYMBOL))).thenReturn(quote());
    when(tradingService.findRandomQuotes(RANDOM_QUOTES_COUNT)).thenReturn(quotes());
    when(tradingService.findQuotesBySymbols(anySetOf(String.class))).thenReturn(quotes());
    when(tradingService.findAccount(eq(ACCOUNT_ID))).thenReturn(account());
    when(tradingService.findAccountByProfile(any(Accountprofile.class))).thenReturn(account());
    when(tradingService.findPortfolioSummary(eq(ACCOUNT_ID))).thenReturn(portfolioSummary());
    when(tradingService.findMarketSummary()).thenReturn(marketSummary());
    when(tradingService.login(eq(USER_ID), eq(PASSWORD))).thenReturn(accountProfile());
    when(tradingService.login(eq(BAD_USER_ID), eq(BAD_PASSWORD))).thenReturn(null);
    when(tradingService.findHoldingSummary(eq(ACCOUNT_ID))).thenReturn(holdingSummary());

    doNothing().when(tradingService).logout(any(String.class));
    return tradingService;
  }
View Full Code Here

TOP

Related Classes of org.springframework.nanotrader.data.service.TradingService

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.