@Test
public void instrumentNotAlreadyTradedTest() {

	TradeInfoService<M, N, Long> tradeInfoService = mock(TradeInfoService.class);
	OrderInfoService<M, N, Long> orderInfoService = mock(OrderInfoService.class);
	PreOrderValidationService<M, N, Long> service = new PreOrderValidationService<M, N, Long>(tradeInfoService,
			null, null, orderInfoService);
	Collection<Long> accountIds = Lists.newArrayList();
	accountIds.add(TradingTestConstants.accountId);
	accountIds.add(TradingTestConstants.accountId2);
	TradeableInstrument<N> gbpusd = new TradeableInstrument<N>("GBP_USD");
	TradeableInstrument<N> nzdjpy = new TradeableInstrument<N>("NZD_JPY");
	TradeableInstrument<N> audchf = new TradeableInstrument<N>("AUD_CHF");
	when(tradeInfoService.findAllAccountsWithInstrumentTrades(gbpusd)).thenReturn(accountIds);
	assertFalse(service.checkInstrumentNotAlreadyTraded(gbpusd));
	Collection<Long> emptyCollectionIds = Collections.emptyList();
	when(tradeInfoService.findAllAccountsWithInstrumentTrades(nzdjpy)).thenReturn(emptyCollectionIds);
	Collection<Order<N, M>> pendingOrders = Lists.newArrayList();
	when(orderInfoService.pendingOrdersForInstrument(nzdjpy)).thenReturn(pendingOrders);
	pendingOrders.add(mock(Order.class));
	pendingOrders.add(mock(Order.class));
	assertFalse(service.checkInstrumentNotAlreadyTraded(nzdjpy));
	Collection<Order<N, M>> emptyCollectionOrders = Collections.emptyList();
	when(tradeInfoService.findAllAccountsWithInstrumentTrades(audchf)).thenReturn(emptyCollectionIds);
	when(orderInfoService.pendingOrdersForInstrument(audchf)).thenReturn(emptyCollectionOrders);
	assertTrue(service.checkInstrumentNotAlreadyTraded(audchf));
}