Skip to content

Commit

Permalink
[refactor] 이번 주 소비 금액 조회 api 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
m3k0813 committed Aug 22, 2024
1 parent 1ac5e3b commit 2003df7
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@

import java.time.DayOfWeek;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.LocalTime;
import java.time.temporal.TemporalAdjusters;
import java.util.List;
import java.util.NoSuchElementException;
Expand Down Expand Up @@ -308,6 +310,9 @@ void getTopCategoryAndConsumptionAmount_Success() {
LocalDate startOfWeek = goalMonthRandomDay.with(TemporalAdjusters.previousOrSame(DayOfWeek.MONDAY));
LocalDate endOfWeek = goalMonthRandomDay.with(TemporalAdjusters.nextOrSame(DayOfWeek.SUNDAY));

LocalDateTime startOfWeekDateTime = startOfWeek.atStartOfDay();
LocalDateTime endOfWeekDateTime = endOfWeek.atTime(LocalTime.MAX);

ConsumptionGoal topConsumptionGoal = ConsumptionGoal.builder()
.goalAmount(5000L)
.consumeAmount(3000L)
Expand Down Expand Up @@ -338,7 +343,7 @@ void getTopCategoryAndConsumptionAmount_Success() {
.willReturn(avgConsumptionGoalList);

given(consumptionGoalRepository.findAvgConsumptionByCategoryIdAndCurrentWeek(
defaultCategory.getId(), startOfWeek, endOfWeek,
defaultCategory.getId(), startOfWeekDateTime, endOfWeekDateTime,
peerAgeStart, peerAgeEnd, peerGender))
.willReturn(Optional.of(currentWeekConsumptionGoal.getConsumeAmount()));

Expand Down

0 comments on commit 2003df7

Please sign in to comment.