POMEditorPanelViewImpl extends Composite implements POMEditorPanelView { @Override public void setValidName(final boolean isValid) { if (isValid) { pomNameGroup.setValidationState(ValidationState.NONE); pomNameHelpBlock.setText(""); } else { pomNameGroup.setValidationState(ValidationState.ERROR); pomNameHelpBlock.setText(ProjectResources.CONSTANTS.invalidName()); } } POMEditorPanelViewImpl(); @Inject  POMEditorPanelViewImpl(final Event<NotificationEvent> notificationEvent,
                                  final GAVEditor parentGavEditor,
                                  final GAVEditor gavEditor); @Override void setPresenter(final Presenter presenter); @Override void showSaveSuccessful(final String fileName); @Override String getTitleWidget(); @Override void setName(final String projectName); @Override void setDescription(final String projectDescription); @Override void setArtifactID(final String artifactID); @Override void showParentGAV(); @Override void hideParentGAV(); @Override void setParentGAV(final GAV gav); @Override void setGAV(final GAV gav); @Override void addGroupIdChangeHandler(final GroupIdChangeHandler changeHandler); @Override void addArtifactIdChangeHandler(final ArtifactIdChangeHandler changeHandler); @Override void addVersionChangeHandler(final VersionChangeHandler changeHandler); @Override void setReadOnly(); @Override void disableGroupID(final String reason); @Override void disableArtifactID(final String reason); @Override void disableVersion(final String reason); @Override void enableGroupID(); @Override void enableArtifactID(); @Override void enableVersion(); @Override void setTitleText(final String titleText); @Override void setProjectModelTitleText(); @Override void showBusyIndicator(final String message); @Override void hideBusyIndicator(); @Override void setValidName(final boolean isValid); @Override void setValidGroupID(final boolean isValid); @Override void setValidArtifactID(final boolean isValid); @Override void setValidVersion(final boolean isValid); @UiHandler("pomNameTextBox") //Use KeyUpEvent as ValueChangeEvent is only fired when the focus is lost void onNameChange(final KeyUpEvent event); @UiHandler("openProjectContext") void onOpenProjectContext(final ClickEvent event); @UiHandler("pomDescriptionTextArea") void onDescriptionChange(final ValueChangeEvent<String> event);  }
@Test public void testValidName() { view.setValidName(true); verify(pomNameGroup, times(1)).setValidationState(ValidationState.NONE); verify(pomNameHelp, times(1)).setText(""); verify(pomNameGroup, never()).setValidationState(ValidationState.ERROR); }
@Test public void testInvalidName() { view.setValidName(false); verify(pomNameGroup, times(1)).setValidationState(ValidationState.ERROR); verify(pomNameHelp, times(1)).setText(ProjectResources.CONSTANTS.invalidName()); verify(pomNameGroup, never()).setValidationState(ValidationState.NONE); }