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 e47f439 commit 527795f
Showing 1 changed file with 11 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import org.springframework.transaction.annotation.Transactional;

import java.io.IOException;
import java.time.LocalDateTime;
import java.time.ZoneId;
import java.time.ZonedDateTime;
import java.time.temporal.ChronoUnit;
Expand Down Expand Up @@ -63,10 +64,19 @@ public void cancelChallengePayment(String email, Long myChallengeId) {
Member member = getMemberByEmail(email);
MyChallenge myChallenge = getMyChallengeById(myChallengeId);

ZonedDateTime now = ZonedDateTime.now(ZoneId.systemDefault()).truncatedTo(ChronoUnit.DAYS);
ZonedDateTime now = ZonedDateTime.now(ZoneId.systemDefault());
log.info("----------------------------- now : " + now);
log.info("-------- challengeGroup startDate : " + myChallenge.getStartDate());

ZonedDateTime tmp = ZonedDateTime.now(ZoneId.systemDefault()).plusDays(7).truncatedTo(ChronoUnit.DAYS);
if(tmp.equals(myChallenge.getStartDate())) {
log.info("------------------------ now & startdate 비교 O");
}
ZonedDateTime tmp2 = ZonedDateTime.of(LocalDateTime.from(myChallenge.getStartDate()), ZoneId.of("Asia/Seoul"));
if(tmp.equals(tmp2)) {
log.info("------------------------ now & startdate(asia/seoul 설정) 비교 O");
}

validateMember(member, myChallenge);
cancelImportPayment(String.valueOf(myChallenge.getImpUid()));

Expand Down

0 comments on commit 527795f

Please sign in to comment.