Skip to content

Commit

Permalink
hotfix : Test 주석 처리; EmailTestService.java, StatisticCreatorTest.java
Browse files Browse the repository at this point in the history
  • Loading branch information
packdev937 committed Aug 13, 2023
1 parent 7756b06 commit 7ddfd2c
Show file tree
Hide file tree
Showing 2 changed files with 89 additions and 89 deletions.
150 changes: 75 additions & 75 deletions src/test/java/com/umc/yourweather/domain/StatisticCreatorTest.java
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);
// }
//}
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);
// }
//}

0 comments on commit 7ddfd2c

Please sign in to comment.