FutureTaskResultToDomainObjectPromiseWrapper implements Promise<DomainObject> { @Override public boolean isBroken() throws IllegalStateException { for (Future<TaskResult> future : futureList) { if (future.isCancelled()) { return true; } } return false; } FutureTaskResultToDomainObjectPromiseWrapper(Future<TaskResult> future);  FutureTaskResultToDomainObjectPromiseWrapper(Future<TaskResult> future, boolean throwOriginalException);  FutureTaskResultToDomainObjectPromiseWrapper(ResponseMerger<DomainObject> responseMerger);  FutureTaskResultToDomainObjectPromiseWrapper(ResponseMerger<DomainObject> responseMerger, boolean throwOriginalException); @Override boolean isRealized(); @Override boolean isFullfilled(); @Override boolean isBroken(); @Override void await(); @Override void await(long timeout, TimeUnit timeUnit); @Override DomainObject get(); @Override DomainObject get(long timeout, TimeUnit timeUnit); Map<String, String> getHeaders(); @Override synchronized void addListener(PromiseListener promiseListener); void addFutureForTask(Future<TaskResult> future); void addFutureForTask(List<Future<TaskResult>> future); List<Future<TaskResult>> getFutureList();  }
@Test public void testIsBroken() throws Exception { when(future1.isCancelled()).thenReturn(false); when(future2.isCancelled()).thenReturn(false); assertFalse(wrapper.isBroken()); }
@Test public void testIsBrokenFailure() throws Exception { when(future1.isCancelled()).thenReturn(false); when(future2.isCancelled()).thenReturn(true); assertTrue(wrapper.isBroken()); }