public class ServletDispatcherResultTest {
@Test
public void testServletDispatcherLookup() throws Exception {
WebApplication webapp = new WebApplication(true);
webapp.registerMadvocComponents();
final List<String> targets = new ArrayList<String>();
ServletDispatcherResult sdr = new ServletDispatcherResult() {
@Override
protected boolean targetExists(ActionRequest actionRequest, String target) {
targets.add(target);
return false;
}
};
ResultMapper resultMapper = webapp.getComponent(ResultMapper.class);
BeanUtil.setDeclaredProperty(sdr, "resultMapper", resultMapper);
ActionRequest actionRequest = createActionRequest("/hello.world.html");
sdr.render(actionRequest, "ok");