-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
hotfix : Test 주석 처리; EmailTestService.java, StatisticCreatorTest.java
- Loading branch information
1 parent
7756b06
commit 7ddfd2c
Showing
2 changed files
with
89 additions
and
89 deletions.
There are no files selected for viewing
150 changes: 75 additions & 75 deletions
150
src/test/java/com/umc/yourweather/domain/StatisticCreatorTest.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 |
---|---|---|
@@ -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("[email protected]") | ||
.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("[email protected]") | ||
.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); | ||
} | ||
} | ||
//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("[email protected]") | ||
// .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("[email protected]") | ||
// .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); | ||
// } | ||
//} |
28 changes: 14 additions & 14 deletions
28
src/test/java/com/umc/yourweather/service/test/EmailTestService.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 |
---|---|---|
@@ -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); | ||
// } | ||
//} |