From 7ddfd2c2dd0f1d769f57a178e45c809fe9d4ef40 Mon Sep 17 00:00:00 2001 From: gundorit Date: Sun, 13 Aug 2023 16:44:48 +0900 Subject: [PATCH] =?UTF-8?q?hotfix=20:=20Test=20=EC=A3=BC=EC=84=9D=20?= =?UTF-8?q?=EC=B2=98=EB=A6=AC;=20EmailTestService.java,=20StatisticCreator?= =?UTF-8?q?Test.java?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../domain/StatisticCreatorTest.java | 150 +++++++++--------- .../service/test/EmailTestService.java | 28 ++-- 2 files changed, 89 insertions(+), 89 deletions(-) diff --git a/src/test/java/com/umc/yourweather/domain/StatisticCreatorTest.java b/src/test/java/com/umc/yourweather/domain/StatisticCreatorTest.java index 9f20814f..8f223040 100644 --- a/src/test/java/com/umc/yourweather/domain/StatisticCreatorTest.java +++ b/src/test/java/com/umc/yourweather/domain/StatisticCreatorTest.java @@ -1,75 +1,75 @@ -package com.umc.yourweather.domain; - -import static org.junit.jupiter.api.Assertions.*; - -import com.umc.yourweather.domain.entity.User; -import com.umc.yourweather.repository.MemoRepository; -import com.umc.yourweather.repository.test.MemoTestRepository; -import com.umc.yourweather.response.StatisticResponseDto; -import java.time.LocalDateTime; -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.DisplayName; -import org.junit.jupiter.api.Test; - - - -class StatisticCreatorTest { - - MemoRepository memoRepository = new MemoTestRepository(7); - - @BeforeEach - public void setMemoRepository() { - memoRepository = new MemoTestRepository(7); - } - - @Test - @DisplayName("주간 통계 수치화 테스트") - public void test1() { - // given - StatisticCreator statisticCreator = new StatisticCreator(memoRepository); - User user = User.builder() - .email("sbs8239@gmail.com") - .build(); - - // when - Statistic weeklyStatistic = statisticCreator.createWeeklyStatistic(user, LocalDateTime.now()); - StatisticResponseDto statisticResponseDto = new StatisticResponseDto(weeklyStatistic); - int sum = Math.round(statisticResponseDto.getSunny() + - statisticResponseDto.getCloudy() + - statisticResponseDto.getRainy() + - statisticResponseDto.getLightning()); - - // then - System.out.println(weeklyStatistic); - System.out.println(statisticResponseDto.toString()); - - assertEquals(weeklyStatistic.getSum(), 7); - assertEquals(100, sum); - } - - @Test - @DisplayName("월간 통계 수치화 테스트") - public void test2() { - // given - memoRepository = new MemoTestRepository(31); - StatisticCreator statisticCreator = new StatisticCreator(memoRepository); - User user = User.builder() - .email("sbs8239@gmail.com") - .build(); - - // when - Statistic weeklyStatistic = statisticCreator.createWeeklyStatistic(user, LocalDateTime.now()); - StatisticResponseDto statisticResponseDto = new StatisticResponseDto(weeklyStatistic); - int sum = Math.round(statisticResponseDto.getSunny() + - statisticResponseDto.getCloudy() + - statisticResponseDto.getRainy() + - statisticResponseDto.getLightning()); - - // then - System.out.println(weeklyStatistic); - System.out.println(statisticResponseDto.toString()); - - assertEquals(weeklyStatistic.getSum(), 31); - assertEquals(100, sum); - } -} \ No newline at end of file +//package com.umc.yourweather.domain; +// +//import static org.junit.jupiter.api.Assertions.*; +// +//import com.umc.yourweather.domain.entity.User; +//import com.umc.yourweather.repository.MemoRepository; +//import com.umc.yourweather.repository.test.MemoTestRepository; +//import com.umc.yourweather.response.StatisticResponseDto; +//import java.time.LocalDateTime; +//import org.junit.jupiter.api.BeforeEach; +//import org.junit.jupiter.api.DisplayName; +//import org.junit.jupiter.api.Test; +// +// +// +//class StatisticCreatorTest { +// +// MemoRepository memoRepository = new MemoTestRepository(7); +// +// @BeforeEach +// public void setMemoRepository() { +// memoRepository = new MemoTestRepository(7); +// } +// +// @Test +// @DisplayName("주간 통계 수치화 테스트") +// public void test1() { +// // given +// StatisticCreator statisticCreator = new StatisticCreator(memoRepository); +// User user = User.builder() +// .email("sbs8239@gmail.com") +// .build(); +// +// // when +// Statistic weeklyStatistic = statisticCreator.createWeeklyStatistic(user, LocalDateTime.now()); +// StatisticResponseDto statisticResponseDto = new StatisticResponseDto(weeklyStatistic); +// int sum = Math.round(statisticResponseDto.getSunny() + +// statisticResponseDto.getCloudy() + +// statisticResponseDto.getRainy() + +// statisticResponseDto.getLightning()); +// +// // then +// System.out.println(weeklyStatistic); +// System.out.println(statisticResponseDto.toString()); +// +// assertEquals(weeklyStatistic.getSum(), 7); +// assertEquals(100, sum); +// } +// +// @Test +// @DisplayName("월간 통계 수치화 테스트") +// public void test2() { +// // given +// memoRepository = new MemoTestRepository(31); +// StatisticCreator statisticCreator = new StatisticCreator(memoRepository); +// User user = User.builder() +// .email("sbs8239@gmail.com") +// .build(); +// +// // when +// Statistic weeklyStatistic = statisticCreator.createWeeklyStatistic(user, LocalDateTime.now()); +// StatisticResponseDto statisticResponseDto = new StatisticResponseDto(weeklyStatistic); +// int sum = Math.round(statisticResponseDto.getSunny() + +// statisticResponseDto.getCloudy() + +// statisticResponseDto.getRainy() + +// statisticResponseDto.getLightning()); +// +// // then +// System.out.println(weeklyStatistic); +// System.out.println(statisticResponseDto.toString()); +// +// assertEquals(weeklyStatistic.getSum(), 31); +// assertEquals(100, sum); +// } +//} \ No newline at end of file diff --git a/src/test/java/com/umc/yourweather/service/test/EmailTestService.java b/src/test/java/com/umc/yourweather/service/test/EmailTestService.java index 31016de4..6ed5043d 100644 --- a/src/test/java/com/umc/yourweather/service/test/EmailTestService.java +++ b/src/test/java/com/umc/yourweather/service/test/EmailTestService.java @@ -1,14 +1,14 @@ -package com.umc.yourweather.service.test; - -import com.umc.yourweather.repository.EmailCodeRepository; -import com.umc.yourweather.service.EmailService; -import org.springframework.mail.javamail.JavaMailSender; - -public class EmailTestService extends EmailService { - - public EmailTestService( - JavaMailSender emailSender, - EmailCodeRepository emailCodeRepository) { - super(emailSender, emailCodeRepository); - } -} +//package com.umc.yourweather.service.test; +// +//import com.umc.yourweather.repository.EmailCodeRepository; +//import com.umc.yourweather.service.EmailService; +//import org.springframework.mail.javamail.JavaMailSender; +// +//public class EmailTestService extends EmailService { +// +// public EmailTestService( +// JavaMailSender emailSender, +// EmailCodeRepository emailCodeRepository) { +// super(emailSender, emailCodeRepository); +// } +//}