@Test
public void testInterceptorWithPrebound() {

    SessionFactory sessionFactory = createMock(SessionFactory.class);
    Session session = createMock(Session.class);
    replay(sessionFactory, session);
    TransactionSynchronizationManager.bindResource(sessionFactory, new SessionHolder(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.getMessage());
    } finally {
        TransactionSynchronizationManager.unbindResource(sessionFactory);
    }
    verify(sessionFactory, session);
}