@Override
    public void addListener(final FutureListener<V> listener) {
        if (listener == null) {
            throw new NullPointerException("FutureListener is null");
        }

        boolean notifyNow = false;
        synchronized (lock) {
            if (!isDoing()) {
                notifyNow = true;
            } else {
                if (promiseListenerList == null) {
                    promiseListenerList = new ArrayList<>();
                }
                promiseListenerList.add(listener);
            }
        }

        if (notifyNow) {
            notifyListener(listener);
        }
    }
@Test
    public void testAddListener() throws Exception {
        promise.addListener(new FutureListener<String>() {
            @Override
            public void operationComplete(Future<String> future) {
                assertThat(promise.get()).isEqualTo("Done");

            }
        });
        promise.set("Done");
    }