Skip to content

Commit

Permalink
[test #184] 외부 환경 시간을 통제하여 테스트 검증
Browse files Browse the repository at this point in the history
  • Loading branch information
dudxo committed Jan 12, 2025
1 parent 3909632 commit a7bbb30
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -324,6 +324,8 @@ void rejectChatWithEventPublish() {
@Test
void rejectChatAuto() {
// given
final LocalDateTime now = LocalDateTime.now();

List<RejectedChatInquiryDto> rejectedChatInquiryDtos = List.of(
new RejectedChatInquiryDto(1L, MemberFixture.member(1L), MemberFixture.member(2L)),
new RejectedChatInquiryDto(2L, MemberFixture.member(3L), MemberFixture.member(4L))
Expand All @@ -335,11 +337,11 @@ void rejectChatAuto() {
given(chatInquiryRepository.getAutoRejectedChatInquiries()).willReturn(rejectedChatInquiryDtos);

// when
chatInquiryService.rejectChatAuto();
chatInquiryService.rejectChatAuto(now);

// then
verify(chatInquiryRepository).getAutoRejectedChatInquiries();
verify(chatInquiryRepository).updateChatInquiryStatusRejected(LocalDateTime.now());
verify(chatInquiryRepository).updateChatInquiryStatusRejected(now);
verify(memberRepository).refundInMemberIds(rejectedInquirerIds, CHAT_REWARD);
verify(creditHistoryService).saveCreditHistoryInMemberIds(
rejectedInquirerIds, CreditType.CHAT_REFUND, CHAT_REWARD
Expand Down

0 comments on commit a7bbb30

Please sign in to comment.