private void validate(final ScimUser user) throws InvalidScimResourceException {
   if (!usernamePattern.matcher(user.getUserName()).matches()) {
     throw new InvalidScimResourceException(
         "Username must match pattern: " + usernamePattern.pattern());
   }
   if (user.getEmails() == null || user.getEmails().isEmpty()) {
     throw new InvalidScimResourceException("An email must be provided.");
   }
 }
 @Test
 public void testCanCreateUserWithExclamationMark() throws Exception {
   String email = "joe!!@" + generator.generate().toLowerCase() + ".com";
   ScimUser user = getScimUser();
   user.getEmails().clear();
   user.setUserName(email);
   user.setPrimaryEmail(email);
   createUser(user, scimReadWriteToken, null);
 }