-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
hotfix: 이메일 정규식에 언더스코어를 허용하도록 수정 (#205)
* fix: 언더스코어 허용하도록 변경 * refactor: 테스트 접근제어자 제거
- Loading branch information
Showing
2 changed files
with
8 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,14 +16,14 @@ | |
|
||
@SpringBootTest | ||
@ActiveProfiles("test") | ||
public class HongikUnivEmailValidatorTest { | ||
class HongikUnivEmailValidatorTest { | ||
|
||
@Autowired | ||
private HongikUnivEmailValidator hongikUnivEmailValidator; | ||
|
||
@Test | ||
@DisplayName("'g.hongik.ac.kr' 도메인을 가진 이메일을 검증할 수 있다.") | ||
public void validateEmailDomainTest() { | ||
void validateEmailDomainTest() { | ||
String hongikDomainEmail = "[email protected]"; | ||
|
||
assertThatCode(() -> hongikUnivEmailValidator.validate(hongikDomainEmail)) | ||
|
@@ -33,15 +33,15 @@ public void validateEmailDomainTest() { | |
@ParameterizedTest | ||
@ValueSource(strings = {"[email protected]", "[email protected]", "[email protected]", "[email protected]"}) | ||
@DisplayName("'g.hongik.ac.kr'가 아닌 도메인을 가진 이메일을 입력하면 예외를 발생시킨다.") | ||
public void validateEmailDomainMismatchTest(String email) { | ||
void validateEmailDomainMismatchTest(String email) { | ||
assertThatThrownBy(() -> hongikUnivEmailValidator.validate(email)) | ||
.isInstanceOf(CustomException.class) | ||
.hasMessage(ErrorCode.UNIV_EMAIL_DOMAIN_MISMATCH.getMessage()); | ||
} | ||
|
||
@Test | ||
@DisplayName("Email의 '@' 앞 부분에는 연속되지 않은 점이 포함될 수 있다.") | ||
public void validateEmailFormatWithDotsTest() { | ||
void validateEmailFormatWithDotsTest() { | ||
String email = "[email protected]"; | ||
|
||
assertThatCode(() -> hongikUnivEmailValidator.validate(email)).doesNotThrowAnyException(); | ||
|
@@ -52,24 +52,23 @@ public void validateEmailFormatWithDotsTest() { | |
strings = { | ||
"te&[email protected]", | ||
"[email protected]", | ||
"[email protected]", | ||
"te'[email protected]", | ||
"[email protected]", | ||
"[email protected]", | ||
"te,[email protected]", | ||
"te<[email protected]", | ||
"te>[email protected]" | ||
}) | ||
@DisplayName("Email의 '@' 앞 부분에 '&', '=', '_', ''', '-', '+', ',', '<', '>'가 포함되는 경우 예외를 발생시킨다.") | ||
public void validateEmailFormatMismatchTest(String email) { | ||
@DisplayName("Email의 '@' 앞 부분에 '&', '=', ''', '-', '+', ',', '<', '>'가 포함되는 경우 예외를 발생시킨다.") | ||
void validateEmailFormatMismatchTest(String email) { | ||
assertThatThrownBy(() -> hongikUnivEmailValidator.validate(email)) | ||
.isInstanceOf(CustomException.class) | ||
.hasMessage(ErrorCode.UNIV_EMAIL_FORMAT_MISMATCH.getMessage()); | ||
} | ||
|
||
@Test | ||
@DisplayName("Email의 '@' 앞 부분에 '.'이 2개 연속 오는 경우 예외를 발생시킨다.") | ||
public void validateEmailFormatMismatchWithDotsTest() { | ||
void validateEmailFormatMismatchWithDotsTest() { | ||
String email = "[email protected]"; | ||
assertThatThrownBy(() -> hongikUnivEmailValidator.validate(email)) | ||
.isInstanceOf(CustomException.class) | ||
|