@Test public void testIsValid() { when(view.getContainerName()).thenReturn(" ").thenReturn("containerName").thenReturn(""); when(view.getGroupId()).thenReturn(" ").thenReturn("groupId").thenReturn(""); when(view.getArtifactId()).thenReturn(" ").thenReturn("artifactId").thenReturn(""); when(view.getVersion()).thenReturn(" ").thenReturn("1.0").thenReturn(""); assertTrue(presenter.isValid()); verify(view).noErrors(); presenter.setServerTemplate(new ServerTemplate()); assertTrue(presenter.isValid()); verify(view).noErrorOnContainerName(); verify(view).noErrorOnGroupId(); verify(view).noErrorOnArtifactId(); verify(view).noErrorOnVersion(); assertFalse(presenter.isValid()); verify(view).errorOnContainerName(); verify(view).errorOnGroupId(); verify(view).errorOnArtifactId(); verify(view).errorOnVersion(); }
public boolean isValid() { if (mode.equals(Mode.OPTIONAL) && isEmpty()) { view.noErrors(); return true; } boolean hasError = false; if (isContainerNameValid()) { view.noErrorOnContainerName(); } else { view.errorOnContainerName(); hasError = true; } if (isGroupIdValid()) { view.noErrorOnGroupId(); } else { view.errorOnGroupId(); hasError = true; } if (isArtifactIdValid()) { view.noErrorOnArtifactId(); } else { view.errorOnArtifactId(); hasError = true; } if (isVersionValid()) { if (isArtifactSupportedByServer()) { view.noErrorOnVersion(); } else { view.errorOnVersion(); view.errorProductionModeSupportsDoesntSnapshots(); hasError = true; } } else { view.errorOnVersion(); hasError = true; } return !hasError; }
NewContainerFormPresenter implements WizardPage { public boolean isValid() { if (mode.equals(Mode.OPTIONAL) && isEmpty()) { view.noErrors(); return true; } boolean hasError = false; if (isContainerNameValid()) { view.noErrorOnContainerName(); } else { view.errorOnContainerName(); hasError = true; } if (isGroupIdValid()) { view.noErrorOnGroupId(); } else { view.errorOnGroupId(); hasError = true; } if (isArtifactIdValid()) { view.noErrorOnArtifactId(); } else { view.errorOnArtifactId(); hasError = true; } if (isVersionValid()) { if (isArtifactSupportedByServer()) { view.noErrorOnVersion(); } else { view.errorOnVersion(); view.errorProductionModeSupportsDoesntSnapshots(); hasError = true; } } else { view.errorOnVersion(); hasError = true; } return !hasError; } }
NewContainerFormPresenter implements WizardPage { public boolean isValid() { if (mode.equals(Mode.OPTIONAL) && isEmpty()) { view.noErrors(); return true; } boolean hasError = false; if (isContainerNameValid()) { view.noErrorOnContainerName(); } else { view.errorOnContainerName(); hasError = true; } if (isGroupIdValid()) { view.noErrorOnGroupId(); } else { view.errorOnGroupId(); hasError = true; } if (isArtifactIdValid()) { view.noErrorOnArtifactId(); } else { view.errorOnArtifactId(); hasError = true; } if (isVersionValid()) { if (isArtifactSupportedByServer()) { view.noErrorOnVersion(); } else { view.errorOnVersion(); view.errorProductionModeSupportsDoesntSnapshots(); hasError = true; } } else { view.errorOnVersion(); hasError = true; } return !hasError; } @Inject  NewContainerFormPresenter(final Logger logger,
                                     final View view,
                                     final ManagedInstance<ArtifactListWidgetPresenter> artifactListWidgetPresenterProvider,
                                     final Caller<M2RepoService> m2RepoService,
                                     final Caller<SpecManagementService> specManagementService,
                                     final Event<WizardPageStatusChangeEvent> wizardPageStatusChangeEvent); }
NewContainerFormPresenter implements WizardPage { public boolean isValid() { if (mode.equals(Mode.OPTIONAL) && isEmpty()) { view.noErrors(); return true; } boolean hasError = false; if (isContainerNameValid()) { view.noErrorOnContainerName(); } else { view.errorOnContainerName(); hasError = true; } if (isGroupIdValid()) { view.noErrorOnGroupId(); } else { view.errorOnGroupId(); hasError = true; } if (isArtifactIdValid()) { view.noErrorOnArtifactId(); } else { view.errorOnArtifactId(); hasError = true; } if (isVersionValid()) { if (isArtifactSupportedByServer()) { view.noErrorOnVersion(); } else { view.errorOnVersion(); view.errorProductionModeSupportsDoesntSnapshots(); hasError = true; } } else { view.errorOnVersion(); hasError = true; } return !hasError; } @Inject  NewContainerFormPresenter(final Logger logger,
                                     final View view,
                                     final ManagedInstance<ArtifactListWidgetPresenter> artifactListWidgetPresenterProvider,
                                     final Caller<M2RepoService> m2RepoService,
                                     final Caller<SpecManagementService> specManagementService,
                                     final Event<WizardPageStatusChangeEvent> wizardPageStatusChangeEvent); @PostConstruct void init(); void addContentChangeHandler(final ContentChangeHandler contentChangeHandler); @Override String getTitle(); @Override void isComplete(final Callback<Boolean> callback); @Override void initialise(); @Override void prepareView(); Mode getMode(); @Override Widget asWidget(); void clear(); boolean isContainerNameValid(); boolean isGroupIdValid(); boolean isArtifactIdValid(); boolean isVersionValid(); boolean isArtifactSupportedByServer(); boolean isValid(); boolean isEmpty(); ServerTemplate getServerTemplate(); void setServerTemplate(final ServerTemplate serverTemplate); ContainerSpec buildContainerSpec(final String serverTemplateId,
                                            final Map<Capability, ContainerConfig> configs); View getView(); void showBusyIndicator(String deploymentId); void hideBusyIndicator(); GAV getCurrentGAV(); }
NewContainerFormPresenter implements WizardPage { public boolean isValid() { if (mode.equals(Mode.OPTIONAL) && isEmpty()) { view.noErrors(); return true; } boolean hasError = false; if (isContainerNameValid()) { view.noErrorOnContainerName(); } else { view.errorOnContainerName(); hasError = true; } if (isGroupIdValid()) { view.noErrorOnGroupId(); } else { view.errorOnGroupId(); hasError = true; } if (isArtifactIdValid()) { view.noErrorOnArtifactId(); } else { view.errorOnArtifactId(); hasError = true; } if (isVersionValid()) { if (isArtifactSupportedByServer()) { view.noErrorOnVersion(); } else { view.errorOnVersion(); view.errorProductionModeSupportsDoesntSnapshots(); hasError = true; } } else { view.errorOnVersion(); hasError = true; } return !hasError; } @Inject  NewContainerFormPresenter(final Logger logger,
                                     final View view,
                                     final ManagedInstance<ArtifactListWidgetPresenter> artifactListWidgetPresenterProvider,
                                     final Caller<M2RepoService> m2RepoService,
                                     final Caller<SpecManagementService> specManagementService,
                                     final Event<WizardPageStatusChangeEvent> wizardPageStatusChangeEvent); @PostConstruct void init(); void addContentChangeHandler(final ContentChangeHandler contentChangeHandler); @Override String getTitle(); @Override void isComplete(final Callback<Boolean> callback); @Override void initialise(); @Override void prepareView(); Mode getMode(); @Override Widget asWidget(); void clear(); boolean isContainerNameValid(); boolean isGroupIdValid(); boolean isArtifactIdValid(); boolean isVersionValid(); boolean isArtifactSupportedByServer(); boolean isValid(); boolean isEmpty(); ServerTemplate getServerTemplate(); void setServerTemplate(final ServerTemplate serverTemplate); ContainerSpec buildContainerSpec(final String serverTemplateId,
                                            final Map<Capability, ContainerConfig> configs); View getView(); void showBusyIndicator(String deploymentId); void hideBusyIndicator(); GAV getCurrentGAV(); static final String SNAPSHOT; }