ActionClassesResolver { public ActionsContainer resolve() { ActionsContainer actionsContainer = new ActionsContainer(); Map<String, ActionClassInformation> actionClasses = new HashMap<String, ActionClassInformation>(); Map<String, Object> foundActions = springIntegration.getBeansWithAnnotation(ActionClass.class); for (Map.Entry<String, Object> actionClassEntry : foundActions.entrySet()) { String actionClassBeanName = actionClassEntry.getKey(); Object actionClass = actionClassEntry.getValue(); ActionClassInformation actionClassInformation = prepareActionClassInformation(actionClass, actionClassBeanName); actionClasses.put(actionClassInformation.getName(), actionClassInformation); actionInterceptorsResolver.resolveInterceptors(actionClassInformation); } actionsContainer.setActionClasses(actionClasses); return actionsContainer; }  ActionsContainer resolve();  }
@Test public void shouldResolveCorrectly() { ActionsContainer container = actionClassesResolver.resolve(); assertNotNull(container); ActionClassInformation classInformation = container.getActionClass(SimpleActionClass.NAME); assertNotNull(classInformation); assertEquals(SimpleActionClass.NAME, classInformation.getName()); assertEquals("sampleActionBean", classInformation.getSpringBeanName()); assertEquals(SimpleActionClass.class, classInformation.getType()); assertTrue(classInformation.isSingleton()); assertNotNull(classInformation.getSingletonActionClassInstance()); }
@Test(expected = BrokenActionProtocolException.class) public void shouldResolveCorrectlyNotAnnotatedNotAdded() { ActionsContainer container = actionClassesResolver.resolve(); assertNotNull(container); container.getActionClass("notAnnotatedAction"); }