Skip to content

Commit

Permalink
@jsonformat 추가 (#800)
Browse files Browse the repository at this point in the history
* refactor: (#799) @jsonformat 추가

* refactor: (#799) 테스트 코드 수정
  • Loading branch information
tjdtls690 authored Oct 19, 2023
1 parent 25e5118 commit 8110916
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.votogether.domain.notice.dto.response;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.votogether.domain.notice.entity.Notice;
import io.swagger.v3.oas.annotations.media.Schema;
import java.time.LocalDateTime;
Expand All @@ -22,9 +23,11 @@ public record NoticeResponse(
String content,

@Schema(description = "공지사항 배너 마감기한", example = "2023-12-25 23:59")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm")
LocalDateTime deadline,

@Schema(description = "공지사항 생성시각", example = "2023-12-25 23:59")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm")
LocalDateTime createdAt
) {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import com.votogether.test.ControllerTest;
import io.restassured.module.mockmvc.RestAssuredMockMvc;
import java.time.LocalDateTime;
import java.time.temporal.ChronoUnit;
import java.util.List;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.DisplayName;
Expand Down Expand Up @@ -52,8 +53,8 @@ void getProgressNotice() throws Exception {
"bannerTitle",
"bannerSubtitle",
"content",
LocalDateTime.now().plusDays(1),
LocalDateTime.now()
LocalDateTime.now().plusDays(1).truncatedTo(ChronoUnit.MINUTES),
LocalDateTime.now().truncatedTo(ChronoUnit.MINUTES)
);
given(noticeQueryService.getProgressNotice()).willReturn(expected);

Expand Down Expand Up @@ -86,8 +87,8 @@ void getNotices() throws Exception {
"bannerTitle",
"bannerSubtitle",
"content",
LocalDateTime.now().plusDays(1),
LocalDateTime.now()
LocalDateTime.now().plusDays(1).truncatedTo(ChronoUnit.MINUTES),
LocalDateTime.now().truncatedTo(ChronoUnit.MINUTES)
);
NoticePageResponse expected = new NoticePageResponse(1, 0, List.of(noticeResponse));
given(noticeQueryService.getNotices(anyInt())).willReturn(expected);
Expand Down Expand Up @@ -153,8 +154,8 @@ void getNotice() throws Exception {
"bannerTitle",
"bannerSubtitle",
"content",
LocalDateTime.now().plusDays(1),
LocalDateTime.now()
LocalDateTime.now().plusDays(1).truncatedTo(ChronoUnit.MINUTES),
LocalDateTime.now().truncatedTo(ChronoUnit.MINUTES)
);
given(noticeQueryService.getNotice(anyLong())).willReturn(expected);

Expand Down

0 comments on commit 8110916

Please sign in to comment.