private <T> SetUp<T> setUp(Class<T> clazz, String methodName, String action) throws IOException {
T cntrl = injector.getInstance(clazz);
Set<Class<?>> controllerClasses = new HashSet<Class<?>>();
controllerClasses.add(cntrl.getClass());
ControllerDatabase db = newControllerDatabase(controllerClasses);
FastClass fastClass = FastClass.create(clazz);
int fastIndex = fastClass.getIndex(methodName, new Class<?>[] {});
ActionSignature sig = mock(ActionSignature.class);
when(sig.fastIndex()).thenReturn(fastIndex);
when(sig.parameterTypes()).thenReturn(new Class<?>[] {});
when(sig.methodName()).thenReturn(methodName);
when(sig.getArgs(parametersMap, req.getInputStream())).thenReturn(new Object[] {});
if (action == null) {
when(sig.getInterceptorClasses(db, cntrl.getClass(), "")).thenReturn(
db.getInterceptorsForDefaultAction(cntrl.getClass()));
} else {
when(sig.getInterceptorClasses(db, cntrl.getClass(), action)).thenReturn(
db.getInterceptorsForAction(cntrl.getClass(), action));
}
when(sig.marshall(anyObject())).thenAnswer(new Answer<View>() {
@Override
public View answer(InvocationOnMock invocation) throws Throwable {