@Test(expected = IllegalArgumentException.class) public void idInvalidStart() { ScmRepository.assertValidId(" foo"); }
public static String assertValidId(String id) { if (id == null) { throw new IllegalArgumentException( String.format("Invalid %s.id [%s]: cannot be null", ScmRepository.class.getSimpleName(), id)); } else if (id.isEmpty()) { throw new IllegalArgumentException( String.format("Invalid %s.id [%s]: cannot be empty", ScmRepository.class.getSimpleName(), id)); } else if (id.charAt(0) == (ID_DELIMITER)) { throw new IllegalArgumentException(String.format("Invalid %s.id [%s]: cannot start with '.'", ScmRepository.class.getSimpleName(), id)); } else if (id.charAt(id.length() - 1) == (ID_DELIMITER)) { throw new IllegalArgumentException( String.format("Invalid %s.id [%s]: cannot end with '.'", ScmRepository.class.getSimpleName(), id)); } else { int subsequentDelimiterCount = 0; for (int i = 0; i < id.length(); i++) { char ch = id.charAt(i); if (ch == ID_DELIMITER) { subsequentDelimiterCount++; if (subsequentDelimiterCount > 1) { throw new IllegalArgumentException(String.format( "Invalid %s.id [%s]: cannot contain mutiple delimiters ('.') one after another", ScmRepository.class.getSimpleName(), id)); } } else if (subsequentDelimiterCount > 0 || i == 0) { if (!Character.isJavaIdentifierStart(ch)) { throw new IllegalArgumentException(String.format( "Invalid %s.id [%s]: Invalid character [%s] at position [%d]; a Java identifier start expected", ScmRepository.class.getSimpleName(), id, ch, i)); } else { subsequentDelimiterCount = 0; } } else if (!Character.isJavaIdentifierPart(ch) && ch != '-') { throw new IllegalArgumentException(String.format( "Invalid %s.id [%s]: Invalid character [%s] at position [%d]; a Java identifier part expected", ScmRepository.class.getSimpleName(), id, ch, i)); } } } return id; }
ScmRepository { public static String assertValidId(String id) { if (id == null) { throw new IllegalArgumentException( String.format("Invalid %s.id [%s]: cannot be null", ScmRepository.class.getSimpleName(), id)); } else if (id.isEmpty()) { throw new IllegalArgumentException( String.format("Invalid %s.id [%s]: cannot be empty", ScmRepository.class.getSimpleName(), id)); } else if (id.charAt(0) == (ID_DELIMITER)) { throw new IllegalArgumentException(String.format("Invalid %s.id [%s]: cannot start with '.'", ScmRepository.class.getSimpleName(), id)); } else if (id.charAt(id.length() - 1) == (ID_DELIMITER)) { throw new IllegalArgumentException( String.format("Invalid %s.id [%s]: cannot end with '.'", ScmRepository.class.getSimpleName(), id)); } else { int subsequentDelimiterCount = 0; for (int i = 0; i < id.length(); i++) { char ch = id.charAt(i); if (ch == ID_DELIMITER) { subsequentDelimiterCount++; if (subsequentDelimiterCount > 1) { throw new IllegalArgumentException(String.format( "Invalid %s.id [%s]: cannot contain mutiple delimiters ('.') one after another", ScmRepository.class.getSimpleName(), id)); } } else if (subsequentDelimiterCount > 0 || i == 0) { if (!Character.isJavaIdentifierStart(ch)) { throw new IllegalArgumentException(String.format( "Invalid %s.id [%s]: Invalid character [%s] at position [%d]; a Java identifier start expected", ScmRepository.class.getSimpleName(), id, ch, i)); } else { subsequentDelimiterCount = 0; } } else if (!Character.isJavaIdentifierPart(ch) && ch != '-') { throw new IllegalArgumentException(String.format( "Invalid %s.id [%s]: Invalid character [%s] at position [%d]; a Java identifier part expected", ScmRepository.class.getSimpleName(), id, ch, i)); } } } return id; } }
ScmRepository { public static String assertValidId(String id) { if (id == null) { throw new IllegalArgumentException( String.format("Invalid %s.id [%s]: cannot be null", ScmRepository.class.getSimpleName(), id)); } else if (id.isEmpty()) { throw new IllegalArgumentException( String.format("Invalid %s.id [%s]: cannot be empty", ScmRepository.class.getSimpleName(), id)); } else if (id.charAt(0) == (ID_DELIMITER)) { throw new IllegalArgumentException(String.format("Invalid %s.id [%s]: cannot start with '.'", ScmRepository.class.getSimpleName(), id)); } else if (id.charAt(id.length() - 1) == (ID_DELIMITER)) { throw new IllegalArgumentException( String.format("Invalid %s.id [%s]: cannot end with '.'", ScmRepository.class.getSimpleName(), id)); } else { int subsequentDelimiterCount = 0; for (int i = 0; i < id.length(); i++) { char ch = id.charAt(i); if (ch == ID_DELIMITER) { subsequentDelimiterCount++; if (subsequentDelimiterCount > 1) { throw new IllegalArgumentException(String.format( "Invalid %s.id [%s]: cannot contain mutiple delimiters ('.') one after another", ScmRepository.class.getSimpleName(), id)); } } else if (subsequentDelimiterCount > 0 || i == 0) { if (!Character.isJavaIdentifierStart(ch)) { throw new IllegalArgumentException(String.format( "Invalid %s.id [%s]: Invalid character [%s] at position [%d]; a Java identifier start expected", ScmRepository.class.getSimpleName(), id, ch, i)); } else { subsequentDelimiterCount = 0; } } else if (!Character.isJavaIdentifierPart(ch) && ch != '-') { throw new IllegalArgumentException(String.format( "Invalid %s.id [%s]: Invalid character [%s] at position [%d]; a Java identifier part expected", ScmRepository.class.getSimpleName(), id, ch, i)); } } } return id; } private  ScmRepository(String id, Charset encoding, List<String> includes, List<String> excludes, List<String> urls,
            List<String> buildArgs, boolean skipTests, boolean addDefaultBuildArguments, ScmRepositoryMaven maven,
            ScmRepositoryGradle gradle, Duration buildTimeout, boolean logToFile, boolean logToConsole,
            Verbosity verbosity, SrcVersion buildRef, Pattern buildVersionPattern); }
ScmRepository { public static String assertValidId(String id) { if (id == null) { throw new IllegalArgumentException( String.format("Invalid %s.id [%s]: cannot be null", ScmRepository.class.getSimpleName(), id)); } else if (id.isEmpty()) { throw new IllegalArgumentException( String.format("Invalid %s.id [%s]: cannot be empty", ScmRepository.class.getSimpleName(), id)); } else if (id.charAt(0) == (ID_DELIMITER)) { throw new IllegalArgumentException(String.format("Invalid %s.id [%s]: cannot start with '.'", ScmRepository.class.getSimpleName(), id)); } else if (id.charAt(id.length() - 1) == (ID_DELIMITER)) { throw new IllegalArgumentException( String.format("Invalid %s.id [%s]: cannot end with '.'", ScmRepository.class.getSimpleName(), id)); } else { int subsequentDelimiterCount = 0; for (int i = 0; i < id.length(); i++) { char ch = id.charAt(i); if (ch == ID_DELIMITER) { subsequentDelimiterCount++; if (subsequentDelimiterCount > 1) { throw new IllegalArgumentException(String.format( "Invalid %s.id [%s]: cannot contain mutiple delimiters ('.') one after another", ScmRepository.class.getSimpleName(), id)); } } else if (subsequentDelimiterCount > 0 || i == 0) { if (!Character.isJavaIdentifierStart(ch)) { throw new IllegalArgumentException(String.format( "Invalid %s.id [%s]: Invalid character [%s] at position [%d]; a Java identifier start expected", ScmRepository.class.getSimpleName(), id, ch, i)); } else { subsequentDelimiterCount = 0; } } else if (!Character.isJavaIdentifierPart(ch) && ch != '-') { throw new IllegalArgumentException(String.format( "Invalid %s.id [%s]: Invalid character [%s] at position [%d]; a Java identifier part expected", ScmRepository.class.getSimpleName(), id, ch, i)); } } } return id; } private  ScmRepository(String id, Charset encoding, List<String> includes, List<String> excludes, List<String> urls,
            List<String> buildArgs, boolean skipTests, boolean addDefaultBuildArguments, ScmRepositoryMaven maven,
            ScmRepositoryGradle gradle, Duration buildTimeout, boolean logToFile, boolean logToConsole,
            Verbosity verbosity, SrcVersion buildRef, Pattern buildVersionPattern); static String assertValidId(String id); static Builder builder(); static Path getIdAsPath(String id); static char getIdDelimiter(); @Override boolean equals(Object obj); List<String> getBuildArguments(); SrcVersion getBuildRef(); Duration getBuildTimeout(); Pattern getBuildVersionPattern(); Charset getEncoding(); List<String> getExcludes(); GavSet getGavSet(); ScmRepositoryGradle getGradle(); String getId(); Path getIdAsPath(); List<String> getIncludes(); ScmRepositoryMaven getMaven(); List<String> getUrls(); Verbosity getVerbosity(); @Override int hashCode(); boolean isAddDefaultBuildArguments(); boolean isLogToConsole(); boolean isLogToFile(); boolean isSkipTests(); @Override String toString(); }
ScmRepository { public static String assertValidId(String id) { if (id == null) { throw new IllegalArgumentException( String.format("Invalid %s.id [%s]: cannot be null", ScmRepository.class.getSimpleName(), id)); } else if (id.isEmpty()) { throw new IllegalArgumentException( String.format("Invalid %s.id [%s]: cannot be empty", ScmRepository.class.getSimpleName(), id)); } else if (id.charAt(0) == (ID_DELIMITER)) { throw new IllegalArgumentException(String.format("Invalid %s.id [%s]: cannot start with '.'", ScmRepository.class.getSimpleName(), id)); } else if (id.charAt(id.length() - 1) == (ID_DELIMITER)) { throw new IllegalArgumentException( String.format("Invalid %s.id [%s]: cannot end with '.'", ScmRepository.class.getSimpleName(), id)); } else { int subsequentDelimiterCount = 0; for (int i = 0; i < id.length(); i++) { char ch = id.charAt(i); if (ch == ID_DELIMITER) { subsequentDelimiterCount++; if (subsequentDelimiterCount > 1) { throw new IllegalArgumentException(String.format( "Invalid %s.id [%s]: cannot contain mutiple delimiters ('.') one after another", ScmRepository.class.getSimpleName(), id)); } } else if (subsequentDelimiterCount > 0 || i == 0) { if (!Character.isJavaIdentifierStart(ch)) { throw new IllegalArgumentException(String.format( "Invalid %s.id [%s]: Invalid character [%s] at position [%d]; a Java identifier start expected", ScmRepository.class.getSimpleName(), id, ch, i)); } else { subsequentDelimiterCount = 0; } } else if (!Character.isJavaIdentifierPart(ch) && ch != '-') { throw new IllegalArgumentException(String.format( "Invalid %s.id [%s]: Invalid character [%s] at position [%d]; a Java identifier part expected", ScmRepository.class.getSimpleName(), id, ch, i)); } } } return id; } private  ScmRepository(String id, Charset encoding, List<String> includes, List<String> excludes, List<String> urls,
            List<String> buildArgs, boolean skipTests, boolean addDefaultBuildArguments, ScmRepositoryMaven maven,
            ScmRepositoryGradle gradle, Duration buildTimeout, boolean logToFile, boolean logToConsole,
            Verbosity verbosity, SrcVersion buildRef, Pattern buildVersionPattern); static String assertValidId(String id); static Builder builder(); static Path getIdAsPath(String id); static char getIdDelimiter(); @Override boolean equals(Object obj); List<String> getBuildArguments(); SrcVersion getBuildRef(); Duration getBuildTimeout(); Pattern getBuildVersionPattern(); Charset getEncoding(); List<String> getExcludes(); GavSet getGavSet(); ScmRepositoryGradle getGradle(); String getId(); Path getIdAsPath(); List<String> getIncludes(); ScmRepositoryMaven getMaven(); List<String> getUrls(); Verbosity getVerbosity(); @Override int hashCode(); boolean isAddDefaultBuildArguments(); boolean isLogToConsole(); boolean isLogToFile(); boolean isSkipTests(); @Override String toString();  }