### Question:
CTSBlacklist implements Blacklist<T> { @Override public boolean isBlacklisted(T entry) throws BlacklistException { try { return cts.read(entry.getStableStorageID()) != null; } catch (CoreTokenException ex) { DEBUG.error("CTSBlacklist: error checking blacklist", ex); throw new BlacklistException(ex); } } @Inject  CTSBlacklist(CTSPersistentStore cts, TokenType tokenType,
            @Named(CoreTokenConstants.CTS_SCHEDULED_SERVICE) ScheduledExecutorService scheduler,
            ThreadMonitor threadMonitor, WebtopNamingQuery serverConfig, long purgeDelayMs, long pollIntervalMs); @Override void blacklist(T entry); @Override boolean isBlacklisted(T entry); @Override void subscribe(final Listener listener);  }### Answer:
@Test public void shouldReturnTrueForBlacklistedSessions() throws Exception { given(mockCts.read(SID)).willReturn(new Token(SID, TokenType.SESSION_BLACKLIST)); final boolean result = testBlacklist.isBlacklisted(mockSession); assertThat(result).isTrue(); }
@Test public void shouldReturnFalseForNonBlacklistedSessions() throws Exception { given(mockCts.read(SID)).willReturn(null); final boolean result = testBlacklist.isBlacklisted(mockSession); assertThat(result).isFalse(); }
@Test public void shouldConvertCtsReadExceptions() throws Exception { given(mockCts.read(SID)).willThrow(new CoreTokenException("test")); assertThatThrownBy( new ThrowableAssert.ThrowingCallable() { @Override public void call() throws Throwable { testBlacklist.isBlacklisted(mockSession); } }) .isInstanceOf(BlacklistException.class); }