@SafeVarargs
    public final PromiseAggregator<V, F> add(Promise<V>... promises) {
        ObjectUtil.checkNotNull(promises, "promises");
        if (promises.length == 0) {
            return this;
        }
        synchronized (this) {
            if (pendingPromises == null) {
                int size;
                if (promises.length > 1) {
                    size = promises.length;
                } else {
                    size = 2;
                }
                pendingPromises = new LinkedHashSet<Promise<V>>(size);
            }
            for (Promise<V> p : promises) {
                if (p == null) {
                    continue;
                }
                pendingPromises.add(p);
                p.addListener(this);
            }
        }
        return this;
    }
@Test
    public void testAddNullFuture() {
        @SuppressWarnings("unchecked")
        Promise<Void> p = mock(Promise.class);
        @SuppressWarnings("deprecation")
        final PromiseAggregator<Void, Future<Void>> a =
                new PromiseAggregator<Void, Future<Void>>(p);
        assertThrows(NullPointerException.class, new Executable() {
            @Override
            public void execute() {
                a.add((Promise<Void>[]) null);
            }
        });
    }