-
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.
- Loading branch information
Showing
7 changed files
with
46 additions
and
31 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
21 changes: 21 additions & 0 deletions
21
src/main/java/com/gdschongik/gdsc/domain/email/domain/EmailVerificationStatusService.java
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 |
---|---|---|
@@ -0,0 +1,21 @@ | ||
package com.gdschongik.gdsc.domain.email.domain; | ||
|
||
import com.gdschongik.gdsc.domain.member.domain.Member; | ||
import com.gdschongik.gdsc.domain.member.dto.UnivVerificationStatus; | ||
import com.gdschongik.gdsc.global.annotation.DomainService; | ||
import java.util.Optional; | ||
|
||
@DomainService | ||
public class EmailVerificationStatusService { | ||
|
||
public UnivVerificationStatus determineStatus( | ||
Member member, Optional<UnivEmailVerification> univEmailVerification) { | ||
if (member.getAssociateRequirement().isUnivSatisfied()) { | ||
return UnivVerificationStatus.SATISFIED; | ||
} else { | ||
return univEmailVerification.isPresent() | ||
? UnivVerificationStatus.IN_PROGRESS | ||
: UnivVerificationStatus.PENDING; | ||
} | ||
} | ||
} |
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
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 |
---|---|---|
|
@@ -10,9 +10,9 @@ | |
import org.junit.jupiter.params.ParameterizedTest; | ||
import org.junit.jupiter.params.provider.ValueSource; | ||
|
||
class HongikUnivEmailValidatorTest { | ||
class UnivEmailValidatorTest { | ||
|
||
HongikUnivEmailValidator hongikUnivEmailValidator = new HongikUnivEmailValidator(); | ||
UnivEmailValidator univEmailValidator = new UnivEmailValidator(); | ||
|
||
@Test | ||
@DisplayName("'g.hongik.ac.kr' 도메인을 가진 이메일을 검증할 수 있다.") | ||
|
@@ -21,7 +21,7 @@ void validateEmailDomainTest() { | |
String hongikDomainEmail = "[email protected]"; | ||
|
||
// when & then | ||
assertThatCode(() -> hongikUnivEmailValidator.validateSendUnivEmailVerificationLink(hongikDomainEmail, false)) | ||
assertThatCode(() -> univEmailValidator.validateSendUnivEmailVerificationLink(hongikDomainEmail, false)) | ||
.doesNotThrowAnyException(); | ||
} | ||
|
||
|
@@ -30,7 +30,7 @@ void validateEmailDomainTest() { | |
@DisplayName("'g.hongik.ac.kr'가 아닌 도메인을 가진 이메일을 입력하면 예외를 발생시킨다.") | ||
void validateEmailDomainMismatchTest(String email) { | ||
// when & then | ||
assertThatThrownBy(() -> hongikUnivEmailValidator.validateSendUnivEmailVerificationLink(email, false)) | ||
assertThatThrownBy(() -> univEmailValidator.validateSendUnivEmailVerificationLink(email, false)) | ||
.isInstanceOf(CustomException.class) | ||
.hasMessage(ErrorCode.UNIV_EMAIL_DOMAIN_MISMATCH.getMessage()); | ||
} | ||
|
@@ -42,7 +42,7 @@ void validateEmailFormatWithDotsTest() { | |
String email = "[email protected]"; | ||
|
||
// when & then | ||
assertThatCode(() -> hongikUnivEmailValidator.validateSendUnivEmailVerificationLink(email, false)) | ||
assertThatCode(() -> univEmailValidator.validateSendUnivEmailVerificationLink(email, false)) | ||
.doesNotThrowAnyException(); | ||
} | ||
|
||
|
@@ -61,7 +61,7 @@ void validateEmailFormatWithDotsTest() { | |
@DisplayName("Email의 '@' 앞 부분에 '&', '=', ''', '-', '+', ',', '<', '>'가 포함되는 경우 예외를 발생시킨다.") | ||
void validateEmailFormatMismatchTest(String email) { | ||
// when & then | ||
assertThatThrownBy(() -> hongikUnivEmailValidator.validateSendUnivEmailVerificationLink(email, false)) | ||
assertThatThrownBy(() -> univEmailValidator.validateSendUnivEmailVerificationLink(email, false)) | ||
.isInstanceOf(CustomException.class) | ||
.hasMessage(ErrorCode.UNIV_EMAIL_FORMAT_MISMATCH.getMessage()); | ||
} | ||
|
@@ -73,7 +73,7 @@ void validateEmailFormatMismatchWithDotsTest() { | |
String email = "[email protected]"; | ||
|
||
// when & then | ||
assertThatThrownBy(() -> hongikUnivEmailValidator.validateSendUnivEmailVerificationLink(email, false)) | ||
assertThatThrownBy(() -> univEmailValidator.validateSendUnivEmailVerificationLink(email, false)) | ||
.isInstanceOf(CustomException.class) | ||
.hasMessage(ErrorCode.UNIV_EMAIL_FORMAT_MISMATCH.getMessage()); | ||
} | ||
|
@@ -84,8 +84,7 @@ void validateEmailFormatMismatchWithDotsTest() { | |
String hongikDomainEmail = "[email protected]"; | ||
|
||
// when & then | ||
assertThatThrownBy( | ||
() -> hongikUnivEmailValidator.validateSendUnivEmailVerificationLink(hongikDomainEmail, true)) | ||
assertThatThrownBy(() -> univEmailValidator.validateSendUnivEmailVerificationLink(hongikDomainEmail, true)) | ||
.isInstanceOf(CustomException.class) | ||
.hasMessage(UNIV_EMAIL_ALREADY_SATISFIED.getMessage()); | ||
} | ||
|