PromiseCombiner { public void finish(Promise<Void> aggregatePromise) { if (doneAdding) { throw new IllegalStateException("Already finished"); } doneAdding = true; this.aggregatePromise = ObjectUtil.checkNotNull(aggregatePromise, "aggregatePromise"); if (doneCount == expectedCount) { tryPromise(); } }  @Deprecated void add(Promise promise); @SuppressWarnings({ "unchecked", "rawtypes" }) void add(Future future); @Deprecated void addAll(Promise... promises); @SuppressWarnings({ "unchecked", "rawtypes" }) void addAll(Future... futures); void finish(Promise<Void> aggregatePromise);  }
@Test public void testNullAggregatePromise() { combiner.finish(p1); verify(p1).trySuccess(null); }
@SuppressWarnings("unchecked") @Test(expected = IllegalStateException.class) public void testFinishCalledTwiceThrows() { combiner.finish(p1); combiner.finish(p1); }