BaseUserEditorWorkflow implements IsWidget { protected void doShow(final String userId) { assert userId != null; doShowEditorView(); checkDirty(new Command() { @Override public void execute() { checkClear(); showLoadingBox(); userSystemManager.users(new RemoteCallback<User>() { @Override public void callback(User o) { hideLoadingBox(); BaseUserEditorWorkflow.this.user = o; assert user != null; userEditorDriver.show(user, userEditor); view.setCancelButtonVisible(false); view.setSaveButtonVisible(false); } }, errorCallback).get(userId); } }); } BaseUserEditorWorkflow(final ClientUserSystemManager userSystemManager,
                                  final Event<OnErrorEvent> errorEvent,
                                  final Event<NotificationEvent> workbenchNotification,
                                  final Event<DeleteUserEvent> deleteUserEvent,
                                  final Event<SaveUserEvent> saveUserEvent,
                                  final ConfirmBox confirmBox,
                                  final UserEditor userEditor,
                                  final UserEditorDriver userEditorDriver,
                                  final ChangePassword changePassword,
                                  final LoadingBox loadingBox,
                                  final EntityWorkflowView view); @Override Widget asWidget(); void clear(); UserEditor getUserEditor(); boolean isDirty(); public EntityWorkflowView view; }
@Test public void testDoShow() { final String userId = "user1"; tested.isDirty = false; tested.doShow(userId); verify(userManagerService, times(1)).get(anyString()); verify(view, times(1)).setCancelButtonVisible(true); verify(view, times(1)).setCallback(any(EntityWorkflowView.Callback.class)); verify(view, times(1)).setSaveButtonText(anyString()); verify(view, times(1)).setWidget(any(IsWidget.class)); verify(view, times(1)).setSaveButtonVisible(true); verify(view, times(2)).setSaveButtonEnabled(false); verify(view, times(2)).clearNotifications(); verify(userEditor, times(1)).clear(); verify(loadingBox, times(1)).show(); verify(loadingBox, times(1)).hide(); verify(userEditorDriver, times(1)).show(user, userEditor); verify(userEditorDriver, times(0)).edit(user, userEditor); verify(view, times(1)).setCancelButtonVisible(false); verify(view, times(1)).setSaveButtonVisible(false); }