final Location l = fabricateLocation(123);
Module module = newModule("Bean", Bean.class);
Element element = newElement(l);
MockControl control = newControl(SchemaProcessor.class);
SchemaProcessor processor = (SchemaProcessor) control.getMock();
processor.getDefiningModule();
control.setReturnValue(module);
processor.push(new Bean());
control.setMatcher(new AggregateArgumentsMatcher(new ArgumentMatcher()
{
public boolean matches(Object expected, Object actual)
{
Bean b = (Bean) actual;
assertEquals("HiveMind", b.getValue());
assertSame(l, b.getLocation());
return true;
}
}));
replayControls();
CreateObjectRule rule = new CreateObjectRule("Bean,value=HiveMind");
rule.begin(processor, element);
verifyControls();
processor.pop();
control.setReturnValue(null);
replayControls();
rule.end(processor, element);