UserCreationWorkflow extends BaseUserEditorWorkflow { void onDeleteUserEvent(@Observes final OnDeleteEvent onDeleteEvent) { if (checkEventContext(onDeleteEvent, getUserEditor())) { doDelete(); } } @Inject  UserCreationWorkflow(final ClientUserSystemManager userSystemManager,
                                final Event<OnErrorEvent> errorEvent,
                                final Event<NotificationEvent> workbenchNotification,
                                final Event<DeleteUserEvent> deleteUserEvent,
                                final Event<SaveUserEvent> saveUserEvent,
                                final Event<CreateUserEvent> createUserEvent,
                                final ConfirmBox confirmBox,
                                final CreateEntity createEntity,
                                final UserEditor userEditor,
                                final UserEditorDriver userEditorDriver,
                                final ChangePassword changePassword,
                                final LoadingBox loadingBox,
                                final EntityWorkflowView view); @PostConstruct void init(); void create(); @Override void clear();  }
@Test public void testOnDeleteUserEvent() { final OnDeleteEvent onDeleteEvent = mock(OnDeleteEvent.class); when(onDeleteEvent.getContext()).thenReturn(userEditor); tested.user = user; doAnswer(new Answer<Void>() { @Override public Void answer(InvocationOnMock invocationOnMock) throws Throwable { final Command callback = (Command) invocationOnMock.getArguments()[2]; callback.execute(); return null; } }).when(confirmBox).show(anyString(), anyString(), any(Command.class), any(Command.class)); tested.onDeleteUserEvent(onDeleteEvent); verify(confirmBox, times(1)).show(anyString(), anyString(), any(Command.class), any(Command.class)); verify(userManagerService, times(1)).delete(anyString()); }