}
public void testAutowire()
{
MockControl fpc = newControl(ServiceImplementationFactoryParameters.class);
ServiceImplementationFactoryParameters fp = (ServiceImplementationFactoryParameters) fpc
.getMock();
MockControl c = newControl(Module.class);
Module module = (Module) c.getMock();
ErrorHandler eh = (ErrorHandler) newMock(ErrorHandler.class);
ClassResolver cr = new DefaultClassResolver();
MockControl logc = newControl(Log.class);
Log log = (Log) logc.getMock();
MockControl messagesControl = newControl(Messages.class);
Messages messages = (Messages) messagesControl.getMock();
ErrorLog errorLog = (ErrorLog) newMock(ErrorLog.class);
// Normally I try and get all the invocations into chronological
// order ... but with this refactoring, that's painful; these
// are in an order that appeases junit.
fp.getLog();
fpc.setReturnValue(log);
fp.getServiceId();
fpc.setReturnValue("foo.bar.Baz");
fp.getInvokingModule();
fpc.setReturnValue(module);
module.resolveType("hivemind.test.services.AutowireTarget");
c.setReturnValue(AutowireTarget.class);
fp.getLog();
fpc.setReturnValue(log);
debug(fpc, fp, logc, log, "Autowired property log to " + log);
fp.getInvokingModule();
fpc.setReturnValue(module);
module.getClassResolver();
c.setReturnValue(cr);
debug(fpc, fp, logc, log, "Autowired property classResolver to " + cr);
fp.getInvokingModule();
fpc.setReturnValue(module);
module.getMessages();
c.setReturnValue(messages);
debug(fpc, fp, logc, log, "Autowired property messages to " + messages);
fp.getInvokingModule();
fpc.setReturnValue(module);
module.getErrorHandler();
c.setReturnValue(eh);
debug(fpc, fp, logc, log, "Autowired property errorHandler to " + eh);
fp.getServiceId();
fpc.setReturnValue("foo.bar.Baz");
debug(fpc, fp, logc, log, "Autowired property serviceId to foo.bar.Baz");
fp.getErrorLog();
fpc.setReturnValue(errorLog);
debug(fpc, fp, logc, log, "Autowired property errorLog to " + errorLog);
replayControls();