@Before public void setUp() throws Exception { mCredentials = new MockMarketDataFeedCredentials(); dataRequest = MarketDataFeedTestSuite.generateDataRequest(); mTokenSpec = MarketDataFeedTokenSpec.generateTokenSpec(dataRequest, new ISubscriber[0]); mFeed = new MockMarketDataFeed(); mFeed.start(); mFeed.login(mCredentials); mToken = MockMarketDataFeedToken.getToken(mTokenSpec, mFeed); }
@Test public void testConstructor() throws Exception { new ExpectedTestFailure(NullPointerException.class) { protected void execute() throws Throwable { mToken = MockMarketDataFeedToken.getToken(null, mFeed); } }.run(); new ExpectedTestFailure(NullPointerException.class) { protected void execute() throws Throwable { mToken = MockMarketDataFeedToken.getToken(mTokenSpec, null); } }.run(); // construct one where all is well with the world mTokenSpec = MarketDataFeedTokenSpec.generateTokenSpec( MarketDataFeedTestSuite.generateDataRequest(), new ISubscriber[0]); MockMarketDataFeedToken token = MockMarketDataFeedToken.getToken(mTokenSpec, mFeed); assertEquals(Status.NOT_STARTED, token.getStatus()); assertEquals(mTokenSpec, token.getTokenSpec()); }