### Question:
HooksPhaseGetter { public List<HookPhase> getHookPhasesBeforeStop(SyncFlowableStep syncFlowableStep, ProcessContext context) { if (syncFlowableStep instanceof BeforeStepHookPhaseProvider) { return ((BeforeStepHookPhaseProvider) syncFlowableStep).getHookPhasesBeforeStep(context); } return Collections.singletonList(HookPhase.NONE); }  List<HookPhase> getHookPhasesBeforeStop(SyncFlowableStep syncFlowableStep, ProcessContext context); List<HookPhase> getHookPhasesAfterStop(SyncFlowableStep syncFlowableStep, ProcessContext context);  }### Answer:
@Test void testGetHookPhasesBeforeStop() { List<HookPhase> hookPhases = List.of(HookPhase.BEFORE_STOP); StopAppStep beforeStepHookPhaseProvider = Mockito.mock(StopAppStep.class); Mockito.when(beforeStepHookPhaseProvider.getHookPhasesBeforeStep(context)) .thenReturn(hookPhases); List<HookPhase> hookPhasesBeforeStop = hooksPhaseGetter.getHookPhasesBeforeStop(beforeStepHookPhaseProvider, context); Assertions.assertEquals(1, hookPhasesBeforeStop.size()); Assertions.assertEquals(hookPhases, hookPhasesBeforeStop); }
@Test void testGetHookPhasesBeforeStopNonHooksClass() { SyncFlowableStep syncFlowableStep = Mockito.mock(SyncFlowableStep.class); List<HookPhase> hookPhasesBeforeStop = hooksPhaseGetter.getHookPhasesBeforeStop(syncFlowableStep, context); Assertions.assertEquals(1, hookPhasesBeforeStop.size()); Assertions.assertEquals(HookPhase.NONE, hookPhasesBeforeStop.get(0)); }