TestListener listener = new TestListener();
final TreeCache cache = createCacheWithListener(listener);
Interceptor lockingInterceptor = new OptimisticLockingInterceptor();
lockingInterceptor.setCache(cache);
Interceptor interceptor = new OptimisticCreateIfNotExistsInterceptor();
interceptor.setCache(cache);
Interceptor nodeInterceptor = new OptimisticNodeInterceptor();
nodeInterceptor.setCache(cache);
MockInterceptor dummy = new MockInterceptor();
dummy.setCache(cache);
lockingInterceptor.setNext(interceptor);
interceptor.setNext(nodeInterceptor);
nodeInterceptor.setNext(dummy);
cache.setInterceptorChain(lockingInterceptor);
// first set up a node with a pojo