@Test public void validName() throws Exception { assertFalse(Account.isValidUsername("a")); assertFalse(Account.isValidUsername(null)); assertFalse(Account.isValidUsername("null")); assertFalse(Account.isValidUsername("NULL")); assertFalse(Account.isValidUsername("abc de")); assertFalse(Account.isValidUsername("1234567890123456")); assertTrue(Account.isValidUsername("abc_de")); assertTrue(Account.isValidUsername("__AAA")); }
public static boolean isValidUsername(String username) { return username != null && username.length() >= NAME_MIN && username.length() <= NAME_MAX && username.matches(NAME_PATTERN) && !username.equalsIgnoreCase("null"); }
Account implements Authorization { public static boolean isValidUsername(String username) { return username != null && username.length() >= NAME_MIN && username.length() <= NAME_MAX && username.matches(NAME_PATTERN) && !username.equalsIgnoreCase("null"); } }
Account implements Authorization { public static boolean isValidUsername(String username) { return username != null && username.length() >= NAME_MIN && username.length() <= NAME_MAX && username.matches(NAME_PATTERN) && !username.equalsIgnoreCase("null"); } Account(UUID accountId,
      String username,
      String email,
      String passwordHash,
      String description,
      Instant createTime,
      Set<Authority> authorities); }
Account implements Authorization { public static boolean isValidUsername(String username) { return username != null && username.length() >= NAME_MIN && username.length() <= NAME_MAX && username.matches(NAME_PATTERN) && !username.equalsIgnoreCase("null"); } Account(UUID accountId,
      String username,
      String email,
      String passwordHash,
      String description,
      Instant createTime,
      Set<Authority> authorities); static Account create(String username,
      String email,
      String passwordHash,
      Instant createTime); static boolean isValidPassword(String password); static boolean isValidUsername(String username); static String renderDescriptionPreview(String description); String getUsername(); UUID getAccountId(); String getEmail(); String getPasswordHash(); Instant getCreateTime(); Set<Authority> getAuthorities(); @Override boolean equals(Object o); @Override int hashCode(); boolean isActivated(); @Override String toString(); @Override UUID authenticatedId(); @Override boolean containsAuthority(Authority authority); @Override boolean matches(Account account); Account withDescription(String description); Account withAuthorities(Set<Authority> authorities); String getRenderDescription(); String getDescription(); String getEscapedDescription(); @VisibleForTesting Account withPasswordHash(String newPasswordHash); }
Account implements Authorization { public static boolean isValidUsername(String username) { return username != null && username.length() >= NAME_MIN && username.length() <= NAME_MAX && username.matches(NAME_PATTERN) && !username.equalsIgnoreCase("null"); } Account(UUID accountId,
      String username,
      String email,
      String passwordHash,
      String description,
      Instant createTime,
      Set<Authority> authorities); static Account create(String username,
      String email,
      String passwordHash,
      Instant createTime); static boolean isValidPassword(String password); static boolean isValidUsername(String username); static String renderDescriptionPreview(String description); String getUsername(); UUID getAccountId(); String getEmail(); String getPasswordHash(); Instant getCreateTime(); Set<Authority> getAuthorities(); @Override boolean equals(Object o); @Override int hashCode(); boolean isActivated(); @Override String toString(); @Override UUID authenticatedId(); @Override boolean containsAuthority(Authority authority); @Override boolean matches(Account account); Account withDescription(String description); Account withAuthorities(Set<Authority> authorities); String getRenderDescription(); String getDescription(); String getEscapedDescription(); @VisibleForTesting Account withPasswordHash(String newPasswordHash); static final int PASSWORD_MIN; static final int PASSWORD_MAX; static final int NAME_MIN; static final int NAME_MAX; static final String NAME_PATTERN; }