AbstractLoginModule implements LoginModule { protected void closeSystemSession() { if (systemSession != null) { try { systemSession.close(); } catch (IOException e) { onError(); log.error(e.getMessage(), e); } systemSession = null; root = null; } }  @Override void initialize(Subject subject, CallbackHandler callbackHandler, Map<String, ?> sharedState, Map<String, ?> options); @Override boolean logout(); @Override boolean abort(); static final String SHARED_KEY_CREDENTIALS; static final String SHARED_KEY_LOGIN_NAME; static final String SHARED_KEY_ATTRIBUTES; static final String SHARED_KEY_PRE_AUTH_LOGIN; }
@Test public void testCloseSystemSession() throws Exception { ContentSession cs = mock(ContentSession.class); ContentRepository cr = mockContentRepository(cs); CallbackHandler cbh = new TestCallbackHandler(cr, mock(SecurityProvider.class)); AbstractLoginModule loginModule = initLoginModule(cbh); loginModule.getRoot(); loginModule.closeSystemSession(); verify(cs, times(1)).close(); }