### Question:
CTSSessionBlacklist implements SessionBlacklist { @Override public boolean isBlacklisted(final Session session) throws SessionException { try { return cts.read(session.getStableStorageID()) != null; } catch (CoreTokenException ex) { DEBUG.error("CTSSessionBlacklist: error checking blacklist", ex); throw new SessionException(ex); } } @Inject  CTSSessionBlacklist(final CTSPersistentStore cts,
                               final @Named(CoreTokenConstants.CTS_SCHEDULED_SERVICE) ScheduledExecutorService scheduler,
                               final ThreadMonitor threadMonitor,
                               final SessionServerConfig serverConfig,
                               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 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(expectedExceptions = SessionException.class) public void shouldConvertCtsReadExceptions() throws Exception { given(mockCts.read(SID)).willThrow(new CoreTokenException("test")); testBlacklist.isBlacklisted(mockSession); }