Skip to content

Commit

Permalink
Test: 날짜 비교 테스트
Browse files Browse the repository at this point in the history
  • Loading branch information
chaewon-io committed Apr 15, 2024
1 parent 31736f9 commit 4933ff9
Showing 1 changed file with 29 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -74,12 +74,41 @@ public List<MyChallengeResponseDto> getMyChallengesListed(String email, Challeng
throw new InvalidChallengeStatusException("유효하지 않은 챌린지 상태 입니다.");
}

log.error("++++++++++++++++++++todayStart &zonedate : " + todayStart.truncatedTo(ChronoUnit.DAYS));
if (!myChallengesListed.isEmpty()) {
log.error("++++++++++++++++++++myChallenge startDate &zonedat : " + myChallengesListed.get(0).getStartDate().truncatedTo(ChronoUnit.DAYS));
if (myChallengesListed.get(0).getStartDate().truncatedTo(ChronoUnit.DAYS).equals(todayStart.truncatedTo(ChronoUnit.DAYS))) {
log.error("++++++++++++++++++++날짜 비교 테스트 성공 LocalDate &zonedat");
}
}


log.error("--------------------------todayStart &localdate: " + todayStart.toLocalDate());
if (!myChallengesListed.isEmpty()) {
log.error("---------------myChallenge startDate &localdate: " + myChallengesListed.get(0).getStartDate().toLocalDate());
if (myChallengesListed.get(0).getStartDate().toLocalDate().equals(todayStart.toLocalDate())) {
log.error("------------날짜 비교 테스트 성공 UTC &localdate");
}
}


log.error("-------------------------------------------------------------------------------");
log.error("-------------------------------------------------------------------------------");
log.error("-------------------------------------------------------------------------------");
log.error("-------------------------------------------------------------------------------");
log.error("--------------------------todayStart : " + todayStart);
if(!myChallengesListed.isEmpty()) {
log.error("---------------myChallenge startDate : " + myChallengesListed.get(0).getStartDate());
if(myChallengesListed.get(0).getStartDate().equals(todayStart)) {
log.error("------------날짜 비교 테스트 성공 UTC");
}

ZoneId zone = myChallengesListed.get(0).getStartDate().getZone();
log.error("-------------------db zone : " + zone);
ZonedDateTime tmp = ZonedDateTime.now(zone).truncatedTo(ChronoUnit.DAYS);
if(tmp.equals(myChallengesListed.get(0).getStartDate())) {
log.error("------------날짜 비교 테스트 성공 " + zone);
}
}

return myChallengesListed.stream()
Expand Down

0 comments on commit 4933ff9

Please sign in to comment.