* association should be gone (and thus it is ready for another tx).
*/
@Test
public void testDifferentTx() throws Exception {
final Interceptor interceptor = new StatefulSessionSynchronizationInterceptor(true);
final InterceptorContext context = new InterceptorContext();
context.setInterceptors(Arrays.asList(noop()));
final StatefulSessionComponent component = mock(StatefulSessionComponent.class);
context.putPrivateData(Component.class, component);
when(component.getAccessTimeout(null)).thenReturn(defaultAccessTimeout());
Cache<SessionID, StatefulSessionComponentInstance> cache = mock(Cache.class);
when(component.getCache()).thenReturn(cache);
final TransactionSynchronizationRegistry transactionSynchronizationRegistry = mock(TransactionSynchronizationRegistry.class);
when(component.getTransactionSynchronizationRegistry()).thenReturn(transactionSynchronizationRegistry);
when(transactionSynchronizationRegistry.getTransactionKey()).thenReturn("TX1");
final List<Synchronization> synchronizations = new LinkedList<Synchronization>();
doAnswer(new Answer<Void>() {
@Override
public Void answer(InvocationOnMock invocation) throws Throwable {
Synchronization synchronization = (Synchronization) invocation.getArguments()[0];
synchronizations.add(synchronization);
return null;
}
}).when(transactionSynchronizationRegistry).registerInterposedSynchronization((Synchronization) any());
final StatefulSessionComponentInstance instance = mock(StatefulSessionComponentInstance.class);
when(instance.getComponent()).thenReturn(component);
context.putPrivateData(ComponentInstance.class, instance);
interceptor.processInvocation(context);
// commit
for (Synchronization synchronization : synchronizations) {