diff --git a/server/src/main/java/access/validation/EmailFormatValidator.java b/server/src/main/java/access/validation/EmailFormatValidator.java index 1a3610eb..99b82c56 100644 --- a/server/src/main/java/access/validation/EmailFormatValidator.java +++ b/server/src/main/java/access/validation/EmailFormatValidator.java @@ -5,7 +5,7 @@ public class EmailFormatValidator implements FormatValidator { private static final Pattern pattern = - Pattern.compile("^\\S+@\\S+$", Pattern.CASE_INSENSITIVE); + Pattern.compile("^.+@.+$", Pattern.CASE_INSENSITIVE); @Override public boolean isValid(String subject) { diff --git a/server/src/test/java/access/validation/EmailFormatValidatorTest.java b/server/src/test/java/access/validation/EmailFormatValidatorTest.java new file mode 100644 index 00000000..29ab4737 --- /dev/null +++ b/server/src/test/java/access/validation/EmailFormatValidatorTest.java @@ -0,0 +1,17 @@ +package access.validation; + +import org.junit.jupiter.api.Test; + +import static org.junit.jupiter.api.Assertions.*; + +class EmailFormatValidatorTest { + + private final EmailFormatValidator emailFormatValidator = new EmailFormatValidator(); + + @Test + void isValid() { + assertTrue(emailFormatValidator.isValid("o@o")); + assertTrue(emailFormatValidator.isValid("Frits Voorbeeld ")); + + } +} \ No newline at end of file