### Question:
StackImageUpdateActions { @Bean(name = "STACK_IMAGE_UPDATE_FINISHED") public AbstractStackImageUpdateAction<?> finishAction() { return new AbstractStackImageUpdateAction<>(CloudPlatformResult.class) { @Override protected void doExecute(StackContext context, CloudPlatformResult payload, Map<Object, Object> variables) { getFlowMessageService().fireEventAndLog(context.getStack().getId(), Status.AVAILABLE.name(), STACK_IMAGE_UPDATE_FINISHED); getStackUpdater().updateStackStatus(context.getStack().getId(), DetailedStackStatus.AVAILABLE); sendEvent(context, new StackEvent(STACK_IMAGE_UPDATE_FINISHED_EVENT.event(), context.getStack().getId())); } }; }  @Bean(name = "CHECK_IMAGE_VERSIONS_STATE") AbstractStackImageUpdateAction<?> checkImageVersion(); @Bean(name = "CHECK_PACKAGE_VERSIONS_STATE") AbstractStackImageUpdateAction<?> checkPackageVersions(); @Bean(name = "UPDATE_IMAGE_STATE") AbstractStackImageUpdateAction<?> updateImage(); @Bean(name = "IMAGE_PREPARE_STATE") AbstractStackImageUpdateAction<?> prepareImageAction(); @Bean(name = "SET_IMAGE_STATE") AbstractStackImageUpdateAction<?> setImageAction(); @Bean(name = "STACK_IMAGE_UPDATE_FINISHED") AbstractStackImageUpdateAction<?> finishAction(); @Bean(name = "STACK_IMAGE_UPDATE_FAILED_STATE") AbstractStackFailureAction<StackImageUpdateState, StackImageUpdateEvent> handleImageUpdateFailure();  }### Answer:
@Test public void finishAction() { FlowEvent flowEvent = Mockito.mock(FlowEvent.class); when(stateContext.getEvent()).thenReturn(flowEvent); when(flowEvent.name()).thenReturn(EVENT_NAME); CloudPlatformResult payload = new CloudPlatformResult(1L); when(stateContext.getMessageHeader(HEADERS.DATA.name())).thenReturn(payload); when(state.getId()).thenReturn(StackImageUpdateState.STACK_IMAGE_UPDATE_FINISHED); finishAction.execute(stateContext); verify(flowMessageService, times(1)).fireEventAndLog(anyLong(), eq(Status.AVAILABLE.name()), eq(ResourceEvent.STACK_IMAGE_UPDATE_FINISHED)); }