### Question:
BloomFilterSessionBlacklist implements SessionBlacklist { @Override public void subscribe(final Listener listener) { delegate.subscribe(listener); } @VisibleForTesting  BloomFilterSessionBlacklist(final SessionBlacklist delegate,
                                final SessionServiceConfig serviceConfig,
                                final BloomFilter<SessionBlacklistEntry> bloomFilter);  BloomFilterSessionBlacklist(final SessionBlacklist delegate,
                                       final SessionServiceConfig serviceConfig); @Override void blacklist(final Session session); @Override boolean isBlacklisted(final Session session); @Override void subscribe(final Listener listener);  }### Answer:
@Test public void shouldSubscribeForUpdatesFromOtherServers() { verify(mockDelegate).subscribe(any(SessionBlacklist.Listener.class)); }
@Test public void shouldAddNotifiedBlacklistedSessionsToTheBloomFilter() { ArgumentCaptor<SessionBlacklist.Listener> listenerArgumentCaptor = ArgumentCaptor.forClass(SessionBlacklist.Listener.class); willDoNothing().given(mockDelegate).subscribe(listenerArgumentCaptor.capture()); testBlacklist = new BloomFilterSessionBlacklist(mockDelegate, mockServiceConfig, mockBloomFilter); SessionBlacklist.Listener listener = listenerArgumentCaptor.getValue(); String id = "testSession"; long expiryTime = 1234l; listener.onBlacklisted(id, expiryTime); verify(mockBloomFilter).add(new BloomFilterSessionBlacklist.SessionBlacklistEntry(id, expiryTime)); }
@Test public void shouldDelegateSubscriptions() { SessionBlacklist.Listener listener = mock(SessionBlacklist.Listener.class); testBlacklist.subscribe(listener); mockDelegate.subscribe(listener); }