ValidationUtil { public static boolean username(String user) { return USERNAME_REGEX.isValid(user); } private  ValidationUtil(); static boolean username(String user); static boolean group(String group); static boolean password(String password); static boolean privateIP(String ip); static boolean address(String address); static boolean port(String port); static boolean port(int port); static boolean path(String path); static boolean version(String version); static boolean email(String email); static boolean ipv4(String ipv4); static final int USER_MAX; static final int USER_MIN; static final int GROUP_MAX; static final int GROUP_MIN; static final int PASSWORD_MAX; static final int PASSWORD_MIN; }
@Test void testUsername() { assertFalse(username(null)); assertFalse(username("test user")); assertFalse(username("_test*")); assertFalse(username("")); assertFalse(username(RandUtil.nextAlphabetic(USER_MAX + 1))); assertFalse(username(RandUtil.nextAlphabetic(USER_MIN - 1))); assertTrue(username("cilki")); }