ClientActionClassesResolver { public Map<String, ClientActionClassInformation> resolve() { Map<String, ClientActionClassInformation> actionClasses = new HashMap<String, ClientActionClassInformation>(); Map<String, Object> foundActions = springIntegration.getActualContext().getBeansWithAnnotation(ClientActionClass.class); for (Map.Entry<String, Object> actionClassEntry : foundActions.entrySet()) { Object actionClass = actionClassEntry.getValue(); ClientActionClassInformation actionClassInformation = prepareActionClass(actionClass); actionClasses.put(actionClassInformation.getName(), actionClassInformation); } return actionClasses; }  Map<String, ClientActionClassInformation> resolve();  }
@Test public void shouldProperlyResolveActionClassNameFromClass() { String actionClassNameFromClassName = MockClientActionClass.class.getSimpleName(); Map<String, ClientActionClassInformation> actionClasses = clientActionClassesResolver.resolve(); assertTrue(actionClasses.containsKey(actionClassNameFromClassName)); ClientActionClassInformation namedFromClassName = actionClasses.get(actionClassNameFromClassName); assertNotNull(namedFromClassName); assertEquals(actionClassNameFromClassName, namedFromClassName.getName()); }
@Test public void shouldProperlyResolveActionClassNameNonStandard() { Map<String, ClientActionClassInformation> actionClasses = clientActionClassesResolver.resolve(); assertTrue(actionClasses.containsKey(NonStandardClientActionClass.NAME)); ClientActionClassInformation namedFromClassName = actionClasses.get(NonStandardClientActionClass.NAME); assertNotNull(namedFromClassName); assertEquals(NonStandardClientActionClass.NAME, namedFromClassName.getName()); }
@Test public void shouldProperlyResolveActionClassExtending() { String actionClassNameFromClassName = ExtendingClientActionClass.class.getSimpleName(); Map<String, ClientActionClassInformation> actionClasses = clientActionClassesResolver.resolve(); assertTrue(actionClasses.containsKey(actionClassNameFromClassName)); ClientActionClassInformation namedFromClassName = actionClasses.get(actionClassNameFromClassName); assertNotNull(namedFromClassName); assertEquals(actionClassNameFromClassName, namedFromClassName.getName()); assertEquals(3, namedFromClassName.getClientActions().size()); }