@Override public void onGroupIdChange() { String groupId = view.getGroupId(); groupId = groupId != null ? groupId.trim() : null; if (groupId != null && !groupId.equals(view.getGroupId())) { view.setGroupId(groupId); } model.setGroupId(groupId); repositoryStructureService.call(new RemoteCallback<Boolean>() { @Override public void callback(Boolean isValid) { if (isValid) { view.clearGroupIdErrorMessage(); } else { view.setGroupIdErrorMessage(Constants.INSTANCE.InvalidGroupId()); } if (isValid != isGroupIdValid) { isGroupIdValid = isValid; fireEvent(); } } }, new DefaultErrorCallback()).isValidGroupId(groupId); }
private void testGroupIdChange(boolean testValidChange) { RepositoryStructurePageExtended structurePage = new RepositoryStructurePageExtended(view, new CallerMock<RepositoryStructureService>(repositoryStructureService), new WizardTestUtils.WizardPageStatusChangeEventMock()); CreateRepositoryWizardModel model = new CreateRepositoryWizardModel(); structurePage.setModel(model); if (testValidChange) { when(view.getGroupId()).thenReturn(VALID_VALUE); } else { when(view.getGroupId()).thenReturn(INVALID_VALUE); } when(repositoryStructureService.isValidGroupId(INVALID_VALUE)).thenReturn(false); when(repositoryStructureService.isValidGroupId(VALID_VALUE)).thenReturn(true); structurePage.onGroupIdChange(); verify(view, times(2)).getGroupId(); if (testValidChange) { verify(view, times(1)).clearGroupIdErrorMessage(); assertEquals(VALID_VALUE, model.getGroupId()); } else { verify(view, times(1)).setGroupIdErrorMessage(anyString()); assertEquals(INVALID_VALUE, model.getGroupId()); } assertPageComplete(false, structurePage); }
when(repositoryStructureService.isValidGroupId(GROUP_ID)).thenReturn(true); when(repositoryStructureService.isValidArtifactId(ARTIFACT_ID)).thenReturn(true); when(repositoryStructureService.isValidVersion(VERSION)).thenReturn(true);
when(repositoryStructureService.isValidGroupId(GROUP_ID)).thenReturn(true); when(repositoryStructureService.isValidArtifactId(ARTIFACT_ID)).thenReturn(true); when(repositoryStructureService.isValidVersion(VERSION)).thenReturn(true);
when(repositoryStructureService.isValidGroupId(GROUP_ID)).thenReturn(true); when(repositoryStructureService.isValidArtifactId(ARTIFACT_ID)).thenReturn(true); when(repositoryStructureService.isValidVersion(VERSION)).thenReturn(true);
when(repositoryStructureService.isValidGroupId(GROUP_ID)).thenReturn(true); when(repositoryStructureService.isValidArtifactId(ARTIFACT_ID)).thenReturn(true); when(repositoryStructureService.isValidVersion(VERSION)).thenReturn(true);
when(repositoryStructureService.isValidGroupId(GROUP_ID)).thenReturn(true); when(repositoryStructureService.isValidArtifactId(ARTIFACT_ID)).thenReturn(true); when(repositoryStructureService.isValidVersion(VERSION)).thenReturn(true);
when(repositoryStructureService.isValidGroupId(groupId)).thenReturn(true); when(repositoryStructureService.isValidArtifactId(artifactId)).thenReturn(true); when(repositoryStructureService.isValidVersion(version)).thenReturn(true);