@Test public void testIsComplete() { final Callback callback = mock( Callback.class ); final String templateName = "templateName"; when( view.getTemplateName() ).thenReturn( templateName ).thenReturn( templateName, templateName, templateName, "" ); when( view.isRuleCapabilityChecked() ).thenReturn( true ); when( view.isProcessCapabilityChecked() ).thenReturn( true ); when( specManagementService.isNewServerTemplateIdValid( templateName ) ).thenReturn( true, false ); presenter.isComplete( callback ); verify( specManagementService ).isNewServerTemplateIdValid( templateName ); verify( callback ).callback( true ); presenter.isComplete( callback ); verify( specManagementService, times( 2 ) ).isNewServerTemplateIdValid( templateName ); verify( callback ).callback( false ); presenter.isComplete( callback ); verify( callback, times( 2 ) ).callback( false ); verify( view ).errorOnTemplateName(); }
@Override public void isComplete(final Callback<Boolean> callback) { if (isValid()) { specManagementService.call(new RemoteCallback<Boolean>() { @Override public void callback(final Boolean result) { if (result.equals(Boolean.FALSE)) { view.errorOnTemplateName(view.getInvalidErrorMessage()); callback.callback(false); } else { callback.callback(true); } } }).isNewServerTemplateIdValid(view.getTemplateName()); } else { callback.callback(false); } }
NewTemplatePresenter implements WizardPage { @Override public void isComplete(final Callback<Boolean> callback) { if (isValid()) { specManagementService.call(new RemoteCallback<Boolean>() { @Override public void callback(final Boolean result) { if (result.equals(Boolean.FALSE)) { view.errorOnTemplateName(view.getInvalidErrorMessage()); callback.callback(false); } else { callback.callback(true); } } }).isNewServerTemplateIdValid(view.getTemplateName()); } else { callback.callback(false); } } }
NewTemplatePresenter implements WizardPage { @Override public void isComplete(final Callback<Boolean> callback) { if (isValid()) { specManagementService.call(new RemoteCallback<Boolean>() { @Override public void callback(final Boolean result) { if (result.equals(Boolean.FALSE)) { view.errorOnTemplateName(view.getInvalidErrorMessage()); callback.callback(false); } else { callback.callback(true); } } }).isNewServerTemplateIdValid(view.getTemplateName()); } else { callback.callback(false); } } @Inject  NewTemplatePresenter(final View view,
                                final Caller<SpecManagementService> specManagementService,
                                final Event<WizardPageStatusChangeEvent> wizardPageStatusChangeEvent); }
NewTemplatePresenter implements WizardPage { @Override public void isComplete(final Callback<Boolean> callback) { if (isValid()) { specManagementService.call(new RemoteCallback<Boolean>() { @Override public void callback(final Boolean result) { if (result.equals(Boolean.FALSE)) { view.errorOnTemplateName(view.getInvalidErrorMessage()); callback.callback(false); } else { callback.callback(true); } } }).isNewServerTemplateIdValid(view.getTemplateName()); } else { callback.callback(false); } } @Inject  NewTemplatePresenter(final View view,
                                final Caller<SpecManagementService> specManagementService,
                                final Event<WizardPageStatusChangeEvent> wizardPageStatusChangeEvent); boolean hasProcessCapability(); String getTemplateName(); @PostConstruct void init(); @Override String getTitle(); @Override void isComplete(final Callback<Boolean> callback); void addContentChangeHandler(final ContentChangeHandler contentChangeHandler); @Override void initialise(); @Override void prepareView(); @Override Widget asWidget(); boolean isValid(); boolean isTemplateNameValid(); boolean isCapabilityValid(); void clear(); boolean isRuleCapabilityChecked(); boolean isProcessCapabilityChecked(); boolean isPlanningCapabilityChecked(); View getView(); }
NewTemplatePresenter implements WizardPage { @Override public void isComplete(final Callback<Boolean> callback) { if (isValid()) { specManagementService.call(new RemoteCallback<Boolean>() { @Override public void callback(final Boolean result) { if (result.equals(Boolean.FALSE)) { view.errorOnTemplateName(view.getInvalidErrorMessage()); callback.callback(false); } else { callback.callback(true); } } }).isNewServerTemplateIdValid(view.getTemplateName()); } else { callback.callback(false); } } @Inject  NewTemplatePresenter(final View view,
                                final Caller<SpecManagementService> specManagementService,
                                final Event<WizardPageStatusChangeEvent> wizardPageStatusChangeEvent); boolean hasProcessCapability(); String getTemplateName(); @PostConstruct void init(); @Override String getTitle(); @Override void isComplete(final Callback<Boolean> callback); void addContentChangeHandler(final ContentChangeHandler contentChangeHandler); @Override void initialise(); @Override void prepareView(); @Override Widget asWidget(); boolean isValid(); boolean isTemplateNameValid(); boolean isCapabilityValid(); void clear(); boolean isRuleCapabilityChecked(); boolean isProcessCapabilityChecked(); boolean isPlanningCapabilityChecked(); View getView();  }