C2Util { public static String getC2RootSymbol(String symbol) { switch(symbol) { case "NQ": return ROOT_SYMBOL_NASDAQ_100; case "ES": return ROOT_SYMBOL_SP500; case "TF": return ROOT_SYMBOL_RUSSEL2K_NYBOT; case "RTY": return ROOT_SYMBOL_RUSSEL2K_GLOBEX; case "YM": return ROOT_SYMBOL_MINI_DOW; case "C": case "ZC": return ROOT_SYMBOL_CORN; default: throw new SumZeroException("Unsupported C2 symbol: " + symbol ); } }  static String getFuturesSymbol(FuturesTicker ticker); static Action getTradeAction( TradeOrder order ); static SymbolType getSymbolType( TradeOrder order ); static OrderType getOrderType( TradeOrder order ); static String getC2RootSymbol(String symbol); static String getTime( ZonedDateTime zonedTime ); static final String ROOT_SYMBOL_RUSSEL2K_NYBOT; static final String ROOT_SYMBOL_RUSSEL2K_GLOBEX; static final String ROOT_SYMBOL_NASDAQ_100; static final String ROOT_SYMBOL_MINI_DOW; static final String ROOT_SYMBOL_SP500; static final String ROOT_SYMBOL_CORN; }
@Test public void testGetC2RootSymbol() { assertEquals( C2Util.ROOT_SYMBOL_NASDAQ_100, C2Util.getC2RootSymbol("NQ")); assertEquals( C2Util.ROOT_SYMBOL_MINI_DOW, C2Util.getC2RootSymbol("YM")); assertEquals(C2Util.ROOT_SYMBOL_RUSSEL2K_NYBOT, C2Util.getC2RootSymbol("TF")); assertEquals(C2Util.ROOT_SYMBOL_RUSSEL2K_GLOBEX, C2Util.getC2RootSymbol("RTY")); assertEquals( C2Util.ROOT_SYMBOL_SP500, C2Util.getC2RootSymbol("ES")); assertEquals( C2Util.ROOT_SYMBOL_CORN, C2Util.getC2RootSymbol("ZC")); assertEquals( C2Util.ROOT_SYMBOL_CORN, C2Util.getC2RootSymbol("C")); try { C2Util.getC2RootSymbol("QQQ"); fail(); } catch( SumZeroException ex ) { } }