### Question:
BloomFilterBlacklist implements Blacklist<T> { @Override public void subscribe(Listener listener) { delegate.subscribe(listener); } @VisibleForTesting  BloomFilterBlacklist(Blacklist<T> delegate, long purgeDelayMs, final BloomFilter<BlacklistEntry> bloomFilter);  BloomFilterBlacklist(Blacklist<T> delegate, long purgeDelayMs); @Override void blacklist(T entry); @Override boolean isBlacklisted(T entry); @Override void subscribe(Listener listener);  }### Answer:
@Test public void shouldSubscribeForUpdatesFromOtherServers() { verify(mockDelegate).subscribe(any(Blacklist.Listener.class)); }
@Test public void shouldAddNotifiedBlacklistedSessionsToTheBloomFilter() { ArgumentCaptor<Blacklist.Listener> listenerArgumentCaptor = ArgumentCaptor.forClass(Blacklist.Listener.class); willDoNothing().given(mockDelegate).subscribe(listenerArgumentCaptor.capture()); testBlacklist = new BloomFilterBlacklist<>(mockDelegate, PURGE_DELAY, mockBloomFilter); Blacklist.Listener listener = listenerArgumentCaptor.getValue(); String id = "testSession"; long expiryTime = 1234l; listener.onBlacklisted(id, expiryTime); verify(mockBloomFilter).add(new BloomFilterBlacklist.BlacklistEntry(id, expiryTime)); }
@Test public void shouldDelegateSubscriptions() { Blacklist.Listener listener = mock(Blacklist.Listener.class); testBlacklist.subscribe(listener); mockDelegate.subscribe(listener); }