RepositoryName implements Serializable, Comparable { public static boolean isValid(final String name) { return !(name == null || name.length() == 0) && !StringUtils.containsWhitespace(name); } RepositoryName(final String name); @Override boolean equals(Object o); @Override int hashCode(); static boolean isValid(final String name); @Override String toString(); @Override int compareTo(Object o);  }
@Test public void testIsValid() throws Exception { assertFalse(RepositoryName.isValid(null)); assertFalse(RepositoryName.isValid("")); assertFalse(RepositoryName.isValid(" ")); assertFalse(RepositoryName.isValid("A A")); assertTrue(RepositoryName.isValid("a")); assertTrue(RepositoryName.isValid("aa")); assertTrue(RepositoryName.isValid("AA")); assertTrue(RepositoryName.isValid("Aa1")); assertTrue(RepositoryName.isValid("Aa1-")); assertTrue(RepositoryName.isValid("-aa1_")); assertTrue(RepositoryName.isValid("testRepos")); assertTrue(RepositoryName.isValid("test_Repos")); assertTrue(RepositoryName.isValid("test-Repos")); assertTrue(RepositoryName.isValid("test-Repos_1")); assertTrue(RepositoryName.isValid("åäö")); }