@Test
public void limitsForCcyTest() {

	final String AUD = "AUD";
	final String NZD = "NZD";
	final String CAD = "CAD";
	final String CHF = "CHF";
	TradeInfoService<M, N, Long> tradeInfoService = mock(TradeInfoService.class);
	OrderInfoService<M, N, Long> orderInfoService = mock(OrderInfoService.class);
	BaseTradingConfig baseTradingCfg = mock(BaseTradingConfig.class);
	PreOrderValidationService<M, N, Long> service = new PreOrderValidationService<M, N, Long>(tradeInfoService,
			null, baseTradingCfg, orderInfoService);
	TradeableInstrument<N> audnzd = new TradeableInstrument<N>(AUD + TradingConstants.CURRENCY_PAIR_SEP_UNDERSCORE
			+ NZD);
	when(baseTradingCfg.getMaxAllowedNetContracts()).thenReturn(4);
	when(tradeInfoService.findNetPositionCountForCurrency(AUD)).thenReturn(4);
	when(tradeInfoService.findNetPositionCountForCurrency(NZD)).thenReturn(3);
	when(orderInfoService.findNetPositionCountForCurrency(AUD)).thenReturn(-1);
	when(orderInfoService.findNetPositionCountForCurrency(NZD)).thenReturn(1);
	assertFalse(service.checkLimitsForCcy(audnzd, TradingSignal.SHORT));
	TradeableInstrument<N> cadchf = new TradeableInstrument<N>(CAD + TradingConstants.CURRENCY_PAIR_SEP_UNDERSCORE
			+ CHF);
	when(tradeInfoService.findNetPositionCountForCurrency(CAD)).thenReturn(5);
	when(tradeInfoService.findNetPositionCountForCurrency(CHF)).thenReturn(1);
	when(orderInfoService.findNetPositionCountForCurrency(CAD)).thenReturn(1);
	when(orderInfoService.findNetPositionCountForCurrency(CHF)).thenReturn(1);
	assertTrue(service.checkLimitsForCcy(cadchf, TradingSignal.SHORT));
}