MockControl fpc = newControl(ServiceImplementationFactoryParameters.class);
ServiceImplementationFactoryParameters fp = (ServiceImplementationFactoryParameters) fpc
.getMock();
ErrorLog log = (ErrorLog) newMock(ErrorLog.class);
fp.getServiceInterface();
fpc.setReturnValue(Runnable.class);
factory.newClass("NewClass", Object.class);
factoryControl.setReturnValue(cf);
cf.addInterface(Runnable.class);
cf.addField("_registry", StrategyRegistry.class);
cf.addConstructor(new Class[]
{ StrategyRegistry.class }, null, "_registry = $1;");
cfc.setMatcher(new AggregateArgumentsMatcher(new ArrayMatcher()));
cf.addMethod(
Modifier.PRIVATE,
new MethodSignature(Runnable.class, "_getStrategy", new Class[]
{ Object.class }, null),
"return (java.lang.Runnable) _registry.getStrategy($1.getClass());");
cfc.setReturnValue(mf);
MethodSignature sig = new MethodSignature(void.class, "run", null, null);
cf.addMethod(Modifier.PUBLIC, sig, "{ }");
cfc.setReturnValue(mf);
fp.getErrorLog();
fpc.setReturnValue(log);
fp.getFirstParameter();
// Slight fudge: we return the location itself when we should return
// an object with this location.
fpc.setReturnValue(l);
log.error(StrategyMessages.improperServiceMethod(sig), l, null);
fp.getServiceId();
fpc.setReturnValue("foo.Bar");
ClassFabUtils.addToStringMethod(cf, StrategyMessages.toString("foo.Bar", Runnable.class));