add unit tests for the user and group name validation

This commit is contained in:
Mohamed Karray
2018-10-01 12:20:17 +02:00
parent ffeb1e9a3f
commit 2bc9a2d70f
4 changed files with 85 additions and 3 deletions

View File

@@ -5,10 +5,10 @@ public final class ValidationConstraints {
private ValidationConstraints() {}
/**
* A user or group name should not start with the @ character
* A user or group name should not start with <code>@</code> or a whitespace
* and it not contains whitespaces
* the characters: . - _ are allowed
* and the characters: . - _ @ are allowed
*/
public static final String USER_GROUP_PATTERN = "^[^@][A-z0-9\\.\\-_]|([A-z0-9\\.\\-_]*[A-z0-9\\.\\-_])?$";
public static final String USER_GROUP_PATTERN = "^[^@\\s][A-z0-9\\.\\-_@]+$";
}