@Test
public void testInterceptor() throws RepositoryException {

    SessionFactory sessionFactory = createMock(SessionFactory.class);
    Session session = createMock(Session.class);
    expect(sessionFactory.getSession()).andReturn(session);
    session.logout();
    expectLastCall().once();
    expect(sessionFactory.getSessionHolder(session)).andReturn(new SessionHolder(session));
    replay(sessionFactory, session);
    JcrInterceptor interceptor = new JcrInterceptor();
    interceptor.setSessionFactory(sessionFactory);
    interceptor.afterPropertiesSet();
    try {
        interceptor.invoke(new TestInvocation(sessionFactory));
    } catch (Throwable t) {
        fail("Should not have thrown Throwable: " + t);
    }
    verify(sessionFactory, session);
}