@Test public void testProjectNameValid() { when(projectValidator.isValid(any())).thenReturn(false); assertFalse(validationService.isProjectNameValid("foo")); when(projectValidator.isValid(any())).thenReturn(true); assertTrue(validationService.isProjectNameValid("t")); assertTrue(validationService.isProjectNameValid("test")); assertTrue(validationService.isProjectNameValid("test_")); assertTrue(validationService.isProjectNameValid("test-")); assertTrue(validationService.isProjectNameValid("test.")); assertTrue(validationService.isProjectNameValid("test0")); assertTrue(validationService.isProjectNameValid("Test-0")); assertTrue(validationService.isProjectNameValid("Test-._")); assertTrue(validationService.isProjectNameValid("Test.test")); assertTrue(validationService.isProjectNameValid("test ")); assertTrue(validationService.isProjectNameValid(" test ")); assertFalse(validationService.isProjectNameValid("test@")); assertFalse(validationService.isProjectNameValid("test\\u1234")); assertFalse(validationService.isProjectNameValid("\\u1234\\u1111")); assertFalse(validationService.isProjectNameValid("test!")); }
@Override public boolean isProjectNameValid(final String projectName) { return moduleNameValidator.isValid(projectName) && NewWorkspaceProjectUtils.sanitizeProjectName(projectName).equals(projectName.replace(" ", "")); }
ValidationServiceImpl implements ValidationService { @Override public boolean isProjectNameValid(final String projectName) { return moduleNameValidator.isValid(projectName) && NewWorkspaceProjectUtils.sanitizeProjectName(projectName).equals(projectName.replace(" ", "")); } }
ValidationServiceImpl implements ValidationService { @Override public boolean isProjectNameValid(final String projectName) { return moduleNameValidator.isValid(projectName) && NewWorkspaceProjectUtils.sanitizeProjectName(projectName).equals(projectName.replace(" ", "")); } ValidationServiceImpl(); @Inject  ValidationServiceImpl(final org.uberfire.ext.editor.commons.service.ValidationService validationService,
                                 final PackageNameValidator packageNameValidator,
                                 final ModuleNameValidator moduleNameValidator,
                                 final JavaFileNameValidator javaFileNameValidator,
                                 final Instance<SaveValidator<?>> saveValidatorInstance,
                                 final Instance<CopyValidator<?>> copyValidatorInstance,
                                 final Instance<DeleteValidator<?>> deleteValidatorInstance); }
ValidationServiceImpl implements ValidationService { @Override public boolean isProjectNameValid(final String projectName) { return moduleNameValidator.isValid(projectName) && NewWorkspaceProjectUtils.sanitizeProjectName(projectName).equals(projectName.replace(" ", "")); } ValidationServiceImpl(); @Inject  ValidationServiceImpl(final org.uberfire.ext.editor.commons.service.ValidationService validationService,
                                 final PackageNameValidator packageNameValidator,
                                 final ModuleNameValidator moduleNameValidator,
                                 final JavaFileNameValidator javaFileNameValidator,
                                 final Instance<SaveValidator<?>> saveValidatorInstance,
                                 final Instance<CopyValidator<?>> copyValidatorInstance,
                                 final Instance<DeleteValidator<?>> deleteValidatorInstance); @Override boolean isProjectNameValid(final String projectName); @Override boolean isPackageNameValid(final String packageName); @Override boolean isFileNameValid(final Path path,
                                   final String fileName); boolean isJavaFileNameValid(final String fileName); @Override boolean isFileNameValid(String fileName); @Override boolean isBranchNameValid(final String branchName); @Override Map<String, Boolean> evaluateJavaIdentifiers(String[] identifiers); @Override Map<String, Boolean> evaluateMavenIdentifiers(String[] identifiers); @Override boolean isTimerIntervalValid(final String timerInterval); @Override boolean validate(final POM pom); @Override boolean validateGroupId(final String groupId); @Override boolean validateArtifactId(final String artifactId); @Override boolean validateGAVVersion(final String version); @Override Collection<ValidationMessage> validateForSave(final Path path,
                                                             final T content); @Override Collection<ValidationMessage> validateForCopy(final Path path,
                                                             final T content); @Override Collection<ValidationMessage> validateForCopy(final Path path); @Override Collection<ValidationMessage> validateForDelete(final Path path,
                                                               final T content); @Override Collection<ValidationMessage> validateForDelete(final Path path); }
ValidationServiceImpl implements ValidationService { @Override public boolean isProjectNameValid(final String projectName) { return moduleNameValidator.isValid(projectName) && NewWorkspaceProjectUtils.sanitizeProjectName(projectName).equals(projectName.replace(" ", "")); } ValidationServiceImpl(); @Inject  ValidationServiceImpl(final org.uberfire.ext.editor.commons.service.ValidationService validationService,
                                 final PackageNameValidator packageNameValidator,
                                 final ModuleNameValidator moduleNameValidator,
                                 final JavaFileNameValidator javaFileNameValidator,
                                 final Instance<SaveValidator<?>> saveValidatorInstance,
                                 final Instance<CopyValidator<?>> copyValidatorInstance,
                                 final Instance<DeleteValidator<?>> deleteValidatorInstance); @Override boolean isProjectNameValid(final String projectName); @Override boolean isPackageNameValid(final String packageName); @Override boolean isFileNameValid(final Path path,
                                   final String fileName); boolean isJavaFileNameValid(final String fileName); @Override boolean isFileNameValid(String fileName); @Override boolean isBranchNameValid(final String branchName); @Override Map<String, Boolean> evaluateJavaIdentifiers(String[] identifiers); @Override Map<String, Boolean> evaluateMavenIdentifiers(String[] identifiers); @Override boolean isTimerIntervalValid(final String timerInterval); @Override boolean validate(final POM pom); @Override boolean validateGroupId(final String groupId); @Override boolean validateArtifactId(final String artifactId); @Override boolean validateGAVVersion(final String version); @Override Collection<ValidationMessage> validateForSave(final Path path,
                                                             final T content); @Override Collection<ValidationMessage> validateForCopy(final Path path,
                                                             final T content); @Override Collection<ValidationMessage> validateForCopy(final Path path); @Override Collection<ValidationMessage> validateForDelete(final Path path,
                                                               final T content); @Override Collection<ValidationMessage> validateForDelete(final Path path);  }