Skip to content

Commit

Permalink
[JT-78] refactor: smtp 테스트 코드 임시
Browse files Browse the repository at this point in the history
  • Loading branch information
Shin-Jae-Yoon committed Sep 21, 2023
1 parent efecf50 commit 336904c
Showing 1 changed file with 19 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,37 +5,35 @@

import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.CsvSource;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.mockito.Mock;
import org.mockito.junit.jupiter.MockitoExtension;
import org.springframework.mail.javamail.JavaMailSenderImpl;
import org.springframework.test.context.ActiveProfiles;

import jakarta.mail.MessagingException;
import shop.jtoon.entity.Mail;

@SpringBootTest
@ActiveProfiles("test")
@ExtendWith(MockitoExtension.class)
class SmtpServiceTest {

@Autowired
@Mock
JavaMailSenderImpl javaMailSender;

@Test
@DisplayName("SMTP 연결 성공")
void smtp_connection_success() {
// when, then
assertThatCode(() -> javaMailSender.testConnection()).doesNotThrowAnyException();
}

@Test
@DisplayName("SMTP 연결 실패")
void smtp_connection_fail() throws MessagingException {
// when, then
JavaMailSenderImpl emptyJavaMailSender = new JavaMailSenderImpl();
assertThatThrownBy(emptyJavaMailSender::testConnection).isInstanceOf(MessagingException.class);
}
// @Test
// @DisplayName("SMTP 연결 성공")
// void smtp_connection_success() {
// // when, then
// assertThatCode(() -> javaMailSender.testConnection()).doesNotThrowAnyException();
// }
//
// @Test
// @DisplayName("SMTP 연결 실패")
// void smtp_connection_fail() throws MessagingException {
// // when, then
// JavaMailSenderImpl emptyJavaMailSender = new JavaMailSenderImpl();
// assertThatThrownBy(emptyJavaMailSender::testConnection).isInstanceOf(MessagingException.class);
// }

@Test
@DisplayName("인증 Mail 생성 성공")
Expand Down

0 comments on commit 336904c

Please sign in to comment.