这是indexloc提供的服务,不要输入任何密码
Skip to content
This repository was archived by the owner on Mar 4, 2021. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public abstract class AWSEmailNotifier implements MonkeyEmailNotifier {
/** The Constant LOGGER. */
private static final Logger LOGGER = LoggerFactory.getLogger(AWSEmailNotifier.class);
private static final String EMAIL_PATTERN =
"^[_A-Za-z0-9-\\+\\.]+(.[_A-Za-z0-9-]+)*@"
"^[_A-Za-z0-9-\\+\\.#]+(.[_A-Za-z0-9-#]+)*@"
+ "[A-Za-z0-9-]+(\\.[A-Za-z0-9]+)*(\\.[A-Za-z]{2,})$";

private final Pattern emailPattern;
Expand Down
32 changes: 32 additions & 0 deletions src/test/java/com/netflix/simianarmy/aws/TestAWSEmailNotifier.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
package com.netflix.simianarmy.aws;

import org.testng.Assert;
import org.testng.annotations.Test;

// CHECKSTYLE IGNORE MagicNumberCheck
public class TestAWSEmailNotifier extends AWSEmailNotifier {
public TestAWSEmailNotifier() {
super(null);
}

@Override
public String buildEmailSubject(String to) {
return null;
}

@Override
public String[] getCcAddresses(String to) {
return new String[0];
}

@Override
public String getSourceAddress(String to) {
return null;
}

@Test
public void testEmailWithHashIsValid() {
TestAWSEmailNotifier emailNotifier = new TestAWSEmailNotifier();
Assert.assertTrue(emailNotifier.isValidEmail("#bla-#name@domain-test.com"), "Email with hash is not valid");
}
}