ServiceImplementationFactory intercepted = (ServiceImplementationFactory) stack.peek();
assertNotNull(intercepted);
SomeService result = (SomeService) intercepted.createCoreServiceImplementation(factoryParameters);
MockSwitcher switcher = (MockSwitcher) Proxy.getInvocationHandler(result);
assertSame(switcher.getRealService(), realCreatedService);
assertSame(switcher.getUnderlyingService(), realCreatedService);
// now tell factory that we always want the mock.
factory.getMockOverride().add(SomeService.class);
assertSame(switcher.getRealService(), realCreatedService);
assertNotSame(switcher.getUnderlyingService(), realCreatedService);
}