### Question:
StreamCancellable implements Cancellable { @Override public void cancel() { myServer.stop(myStreamId); myIsCancelled = true; } StreamCancellable(StreamingServer server, UUID streamId); @Override void cancel(); @Override boolean isCancelled();  }### Answer:
@Test public void testCancel() { EasyMockSupport support = new EasyMockSupport(); UUID streamId = UUID.randomUUID(); StreamingServer server = support.createMock(StreamingServer.class); server.stop(EasyMock.eq(streamId)); support.replayAll(); StreamCancellable cancellable = new StreamCancellable(server, streamId); assertFalse(cancellable.isCancelled()); cancellable.cancel(); assertTrue(cancellable.isCancelled()); support.verifyAll(); }