IndexContractBuilder implements IContractBuilder<IndexTicker> { public Contract buildContract(IndexTicker ticker) { Contract contract = new Contract(); contract.m_currency = ticker.getCurrency(); contract.m_exchange = ticker.getExchange().getExchangeName(); contract.m_secType = IbUtils.getSecurityType( ticker.getInstrumentType() ); contract.m_symbol = ticker.getSymbol(); return contract; }  Contract buildContract(IndexTicker ticker);  }
@Test public void testBuildContract() { IndexContractBuilder builder = new IndexContractBuilder(); IndexTicker ticker = new IndexTicker(); ticker.setSymbol("SPX"); ticker.setExchange(Exchange.CBOE); Contract expected = new Contract(); expected.m_currency = "USD"; expected.m_exchange = "CBOE"; expected.m_secType = "IND"; expected.m_symbol = "SPX"; assertEquals( expected, builder.buildContract(ticker)); }