### Question:
BlockingQueue implements IQueue <T> { @Override public void addNewItemCallback(final Runnable callback) { synchronized (callbacksListLock) { newElementCallbacks.add(callback); if (!queue.isEmpty()) { callback.run(); } } } BlockingQueue(final java.util.concurrent.BlockingQueue<T> queue); @Override void put(final T item); @Override T take(); @Override T tryTake(); @Override void addNewItemCallback(final Runnable callback); @Override void removeNewItemCallback(final Runnable callback);  }### Answer:
@Test public void Should_callCallbackImmediately_When_thereAlreadyAreElementsInQueue() throws Exception { java.util.concurrent.BlockingQueue underlying = mock(java.util.concurrent.BlockingQueue.class); Runnable callback = mock(Runnable.class); when(underlying.isEmpty()).thenReturn(false); IQueue queue = new BlockingQueue<>(underlying); queue.addNewItemCallback(callback); verify(callback).run(); }