@Test
@SuppressWarnings("unchecked")
public void placeOrderTest() {

	BlockingQueue<TradingDecision<N>> orderQueue = new LinkedBlockingQueue<TradingDecision<N>>();
	AccountInfoService<Long, N> accountInfoService = mock(AccountInfoService.class);
	OrderManagementProvider<Long, N, Long> orderManagementProvider = mock(OrderManagementProvider.class);
	BaseTradingConfig baseTradingConfig = mock(BaseTradingConfig.class);
	PreOrderValidationService<Long, N, Long> preOrderValidationService = mock(PreOrderValidationService.class);
	CurrentPriceInfoProvider<N> currentPriceInfoProvider = mock(CurrentPriceInfoProvider.class);
	OrderExecutionService<Long, N, Long> service = new OrderExecutionService<Long, N, Long>(orderQueue,
			accountInfoService, orderManagementProvider, baseTradingConfig, preOrderValidationService,
			currentPriceInfoProvider);
	service.init();
	TradeableInstrument<N> gbpaud = new TradeableInstrument<N>("GBP_AUD");
	TradingSignal signal = TradingSignal.SHORT;
	TradingDecision<N> tradingDecision1 = new TradingDecision<N>(gbpaud, signal, 1.855, 2.21);/*market order*/
	TradingDecision<N> tradingDecision2 = new TradingDecision<N>(gbpaud, signal, 1.855, 2.21, 2.12);/*limit order*/
	when(preOrderValidationService.checkInstrumentNotAlreadyTraded(gbpaud)).thenReturn(true);
	when(preOrderValidationService.checkLimitsForCcy(gbpaud, signal)).thenReturn(true);
	Collection<TradeableInstrument<N>> instruments = Lists.newArrayList();
	instruments.add(gbpaud);
	Map<TradeableInstrument<N>, Price<N>> priceMap = Maps.newHashMap();
	double bidPrice = 2.0557;
	double askPrice = 2.0562;
	priceMap.put(gbpaud, new Price<N>(gbpaud, bidPrice, askPrice, DateTime.now()));
	when(currentPriceInfoProvider.getCurrentPricesForInstruments(eq(instruments))).thenReturn(priceMap);
	when(preOrderValidationService.isInSafeZone(TradingSignal.SHORT, bidPrice, gbpaud)).thenReturn(true);
	when(accountInfoService.findAccountsToTrade()).thenReturn(Lists.newArrayList(TradingTestConstants.accountId));
	when(baseTradingConfig.getMaxAllowedQuantity()).thenReturn(100);
	orderQueue.offer(tradingDecision1);
	orderQueue.offer(tradingDecision2);
	/*this is a dummy trading decision payload, after whose consumption we know that our test case is tested*/
	orderQueue.offer(new TradingDecision<N>(gbpaud, TradingSignal.NONE));
	while (orderQueue.size() > 0) {
		try {
			Thread.sleep(2L);/*sleep instead of spinning*/
		} catch (InterruptedException e) {
			e.printStackTrace();
		}
	}
	verify(orderManagementProvider, times(2)).placeOrder(any(Order.class), eq(TradingTestConstants.accountId));
}