ActionResolverUtils { protected static Action getAction(List<Action> actions, ActionName actionName) { for ( Action action : actions ) { if ( action.getActionName().equals(actionName) ) { return action; } } return null; }    }
@Test public void testGetAction() throws Exception { List<Action> actions = new ArrayList<Action>(); ActionName actionName = mock(ActionName.class); Action action = mock(Action.class); actions.add(action); when(action.getActionName()) .thenReturn(mock(ActionName.class)) .thenReturn(actionName); Assert.assertTrue(ActionResolverUtils.getAction(actions,actionName) == null); Assert.assertTrue(ActionResolverUtils.getAction(actions,actionName) == action); }