MockControl factoryPointControl = newControl(ServicePoint.class);
ServicePoint factoryPoint = (ServicePoint) factoryPointControl.getMock();
MockControl factoryControl = newControl(ServiceImplementationFactory.class);
ServiceImplementationFactory factory = (ServiceImplementationFactory) factoryControl
.getMock();
MockControl pointControl = newControl(ServicePoint.class);
ServicePoint point = (ServicePoint) pointControl.getMock();
SchemaImpl schema = new SchemaImpl("module");
schema.setRootElementClassName(ArrayList.class.getName());
ModuleDefinition md = createModuleDefinition("test");
XmlServicePointDefinitionImpl xmlSpd = new XmlServicePointDefinitionImpl(md);
xmlSpd.setParametersCount(Occurances.REQUIRED);
xmlSpd.setParametersSchema(schema);
Location location = newLocation();
InvokeFactoryServiceConstructor c = new InvokeFactoryServiceConstructor(location, "module");
ErrorLog log = (ErrorLog) newMock(ErrorLog.class);
// Training !
point.getErrorLog();
pointControl.setReturnValue(log);
module.getServicePoint("foo.bar.Baz");
moduleControl.setReturnValue(factoryPoint);
module.resolveType(ArrayList.class.getName());
moduleControl.setReturnValue(ArrayList.class);
factoryPoint.getService(ServiceImplementationFactory.class);
factoryPointControl.setReturnValue(factory);
factoryPoint.getServicePointDefinition();
factoryPointControl.setReturnValue(xmlSpd);
factoryPoint.getModule();
factoryPointControl.setReturnValue(module);
String message = XmlImplMessages
.wrongNumberOfParameters("foo.bar.Baz", 0, Occurances.REQUIRED);
log.error(message, location, null);
factory.createCoreServiceImplementation(new ServiceImplementationFactoryParametersImpl(
point, module, Collections.EMPTY_LIST));
factoryControl.setReturnValue("THE SERVICE");
replayControls();