ActionResolver { public ActionInformation prepareActionInformation(Class<?> clazz, Method action) { ActionInformation actionInformation = prepareAction(clazz, action); List<ActionParameterInformation> parameters = new ArrayList<ActionParameterInformation>(); for (int i = 0; i < action.getParameterTypes().length; i++) { Type parameterType = action.getGenericParameterTypes()[i]; ActionParameterInformation parameterInformation = parametersResolver.prepareActionParameter(parameterType, action.getParameterAnnotations()[i]); parameters.add(parameterInformation); } actionInformation.setParameters(parameters); ActionResponseInformation responseInformation = responseResolver.resolveResponse(action); actionInformation.setResponseInformation(responseInformation); return actionInformation; }  ActionInformation prepareActionInformation(Class<?> clazz, Method action);  }
@Test public void testDefaultAction() throws NoSuchMethodException { Class<SimpleActionClass> simpleActionClass = SimpleActionClass.class; Method defaultAction = simpleActionClass.getMethod("executeDefault", BaseUserContext.class, String.class); ActionInformation actionInformation = actionResolver.prepareActionInformation(simpleActionClass, defaultAction); assertTrue(actionInformation.isDefaultAction()); assertEquals("executeDefault", actionInformation.getName()); assertNotNull(actionInformation.getResponseInformation()); }
@Test public void testWithNonDefaultResponse() throws NoSuchMethodException { Class<SimpleActionClass> simpleActionClass = SimpleActionClass.class; Method defaultAction = simpleActionClass.getMethod("nonDefaultAction", String.class); ActionInformation actionInformation = actionResolver.prepareActionInformation(simpleActionClass, defaultAction); assertFalse(actionInformation.isDefaultAction()); assertEquals("unusualActionName", actionInformation.getName()); ActionResponseInformation responseInformation = actionInformation.getResponseInformation(); assertNotNull(responseInformation); Object serialization = responseInformation.getSerialization(); assertNotNull(serialization); }