### Question:
MapBasedLinkedBlockingQueue implements BlockingQueue<T> { @Override public T poll(long l, TimeUnit timeUnit) throws InterruptedException { Pair<Long, T> result = this.internalQueue.poll(l, timeUnit); if (result != null) { this.internalRemove(result); return result.getValue(); } else { return null; } } MapBasedLinkedBlockingQueue(ConcurrentMap<Long, T> internalMap); @Override void put(T t); @Override boolean offer(T t, long l, TimeUnit timeUnit); @Override boolean offer(T t); @Override T take(); @Override T poll(long l, TimeUnit timeUnit); @Override int remainingCapacity(); @Override T poll(); @Override T element(); @Override T peek(); @Override boolean remove(Object o); @Override boolean containsAll(Collection<?> collection); @Override int size(); @Override boolean isEmpty(); @Override boolean contains(Object o); @Override Iterator<T> iterator(); @Override Object[] toArray(); @Override T1[] toArray(T1[] t1s); @Override void clear(); @Override int drainTo(Collection<? super T> collection); @Override int drainTo(Collection<? super T> collection, int i); @Override boolean add(T t); @Override T remove(); @Override boolean addAll(Collection<? extends T> collection); @Override boolean removeAll(Collection<?> collection); @Override boolean retainAll(Collection<?> collection);  }### Answer:
@Test void pollEmpty() { ConcurrentHashMap<Object, Object> localMap = new ConcurrentHashMap<>(); BlockingQueue<String> queue = new MapBasedLinkedBlockingQueue(localMap); assertNull(queue.poll()); }
@Test void peekEmpty() { ConcurrentHashMap<Object, Object> localMap = new ConcurrentHashMap<>(); BlockingQueue<String> queue = new MapBasedLinkedBlockingQueue(localMap); assertNull(queue.poll()); }