}
@Test
public void decorator_orderering()
{
ObjectCreator core = mockObjectCreator();
Module module = mockModule();
Object coreObject = new Object();
Object interceptor1 = new Object();
Object interceptor2 = new Object();
ServiceDecorator decorator1 = mockServiceDecorator();
ServiceDecorator decorator2 = mockServiceDecorator();
List<ServiceDecorator> decorators = asList(decorator1, decorator2);
train_createObject(core, coreObject);
train_findDecoratorsForService(module, SERVICE_ID, decorators);
// Notice: reverse order!
train_createInterceptor(decorator2, coreObject, interceptor2);
train_createInterceptor(decorator1, interceptor2, interceptor1);
replay();
ObjectCreator isb = new InterceptorStackBuilder(module, SERVICE_ID, core);
Object intercepted = isb.createObject();
assertSame(intercepted, interceptor1);
verify();
}