@Test
  public void testCancel() throws Exception {
    assertTrue(mFeed.getCreatedHandles().isEmpty());
    assertTrue(mFeed.getCanceledHandles().isEmpty());

    MockMarketDataFeedToken token = mFeed.execute(mTokenSpec);
    List<String> createdHandles = mFeed.getCreatedHandles();
    assertFalse(mFeed.getCreatedHandles().isEmpty());
    token.cancel();
    List<String> canceledHandles = mFeed.getCanceledHandles();
    assertTrue(canceledHandles.containsAll(createdHandles));
    assertEquals(createdHandles.size(), canceledHandles.size());
    assertEquals(MockMarketDataFeedToken.Status.CANCELED, token.getStatus());
    // cancel it again, make sure nothing breaks
    token.cancel();
    canceledHandles = mFeed.getCanceledHandles();
    assertTrue(canceledHandles.containsAll(createdHandles));
    assertEquals(createdHandles.size(), canceledHandles.size());
    assertEquals(MockMarketDataFeedToken.Status.CANCELED, token.getStatus());
  }
  @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());
  }