### Question:
ActionExecutor { boolean shouldExecute(final UrlAction action, final PhaseId currentPhaseId, final boolean isPostback) { boolean result = false; if (currentPhaseId.equals(action.getPhaseId()) || PhaseId.ANY_PHASE.equals(action.getPhaseId())) { if (action.onPostback()) { result = true; } else { if (!isPostback) { result = true; } } } return result; }  void executeActions(final FacesContext context, final PhaseId currentPhaseId, final PrettyUrlMapping mapping);  }### Answer:
@Test public void testShouldExecuteOnPostback() { UrlAction action = new UrlAction("action", PhaseId.ANY_PHASE); action.setOnPostback(true); assertTrue(executor.shouldExecute(action, PhaseId.RESTORE_VIEW, true)); }
@Test public void testShouldExecuteOnNonPostback() { UrlAction action = new UrlAction("action", PhaseId.ANY_PHASE); action.setOnPostback(true); assertTrue(executor.shouldExecute(action, PhaseId.RESTORE_VIEW, false)); }
@Test public void testShouldExecuteOnPhaseNonPostback() { UrlAction action = new UrlAction("action", PhaseId.RESTORE_VIEW); action.setOnPostback(true); assertTrue(executor.shouldExecute(action, PhaseId.RESTORE_VIEW, false)); }
@Test public void testShouldNotExecuteOnWrongPhaseNonPostback() { UrlAction action = new UrlAction("action", PhaseId.RESTORE_VIEW); action.setOnPostback(true); assertFalse(executor.shouldExecute(action, PhaseId.APPLY_REQUEST_VALUES, false)); }
@Test public void testShouldExecuteOnPhasePostback() { UrlAction action = new UrlAction("action", PhaseId.RESTORE_VIEW); action.setOnPostback(true); assertTrue(executor.shouldExecute(action, PhaseId.RESTORE_VIEW, true)); }
@Test public void testShouldNotExecuteOnWrongPhasePostback() { UrlAction action = new UrlAction("action", PhaseId.RESTORE_VIEW); action.setOnPostback(true); assertFalse(executor.shouldExecute(action, PhaseId.APPLY_REQUEST_VALUES, true)); }
@Test public void testShouldNotExecuteOnPostbackFalse() { UrlAction action = new UrlAction("action", PhaseId.ANY_PHASE); action.setOnPostback(false); assertFalse(executor.shouldExecute(action, PhaseId.RESTORE_VIEW, true)); }
@Test public void testShouldExecuteOnPostbackFalseWhenNotPostback() { UrlAction action = new UrlAction("action", PhaseId.ANY_PHASE); action.setOnPostback(false); assertTrue(executor.shouldExecute(action, PhaseId.RESTORE_VIEW, false)); }