From 690745cf05767bc95ddc04a90e5cc155ad5a9797 Mon Sep 17 00:00:00 2001 From: skytin1004 Date: Sun, 31 Mar 2024 18:34:37 +0900 Subject: [PATCH 1/3] =?UTF-8?q?[refactor/Inhabas#273]=20=EA=B3=B5=EB=AA=A8?= =?UTF-8?q?=EC=A0=84=20=EA=B2=8C=EC=8B=9C=ED=8C=90=20=EC=8B=9C=EC=9E=91?= =?UTF-8?q?=EC=9D=BC=20=EB=B0=8F=20=EC=A2=85=EB=A3=8C=EC=9D=BC=20LocalDate?= =?UTF-8?q?Time=EC=9C=BC=EB=A1=9C=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../api/domain/contest/domain/ContestBoard.java | 14 +++++++------- .../contest/dto/ContestBoardDetailDto.java | 17 ++++++++++------- .../domain/contest/dto/SaveContestBoardDto.java | 16 +++++++++++----- .../domain/contest/domain/ContestBoardTest.java | 14 +++++++------- .../contest/dto/SaveContestBoardDtoTest.java | 10 +++++----- 5 files changed, 40 insertions(+), 31 deletions(-) diff --git a/resource-server/src/main/java/com/inhabas/api/domain/contest/domain/ContestBoard.java b/resource-server/src/main/java/com/inhabas/api/domain/contest/domain/ContestBoard.java index cc58e15b..4b71f5c0 100644 --- a/resource-server/src/main/java/com/inhabas/api/domain/contest/domain/ContestBoard.java +++ b/resource-server/src/main/java/com/inhabas/api/domain/contest/domain/ContestBoard.java @@ -1,6 +1,6 @@ package com.inhabas.api.domain.contest.domain; -import java.time.LocalDate; +import java.time.LocalDateTime; import java.util.ArrayList; import java.util.Collections; import java.util.List; @@ -52,10 +52,10 @@ public class ContestBoard extends BaseBoard { @Embedded private Content content; @Column(name = "DATE_CONTEST_START", nullable = false) - private LocalDate dateContestStart; + private LocalDateTime dateContestStart; @Column(name = "DATE_CONTEST_END", nullable = false) - private LocalDate dateContestEnd; + private LocalDateTime dateContestEnd; @OneToMany(mappedBy = "parentBoard", cascade = CascadeType.ALL, orphanRemoval = true) private List comments = new ArrayList<>(); @@ -69,8 +69,8 @@ public ContestBoard( String content, String association, String topic, - LocalDate dateContestStart, - LocalDate dateContestEnd) { + LocalDateTime dateContestStart, + LocalDateTime dateContestEnd) { super(title, menu); this.contestField = contestField; @@ -108,8 +108,8 @@ public void updateContest( String content, String association, String topic, - LocalDate dateContestStart, - LocalDate dateContestEnd) { + LocalDateTime dateContestStart, + LocalDateTime dateContestEnd) { this.contestField = contestField; this.title = new Title(title); diff --git a/resource-server/src/main/java/com/inhabas/api/domain/contest/dto/ContestBoardDetailDto.java b/resource-server/src/main/java/com/inhabas/api/domain/contest/dto/ContestBoardDetailDto.java index 33658e8f..9d5313a6 100644 --- a/resource-server/src/main/java/com/inhabas/api/domain/contest/dto/ContestBoardDetailDto.java +++ b/resource-server/src/main/java/com/inhabas/api/domain/contest/dto/ContestBoardDetailDto.java @@ -1,6 +1,5 @@ package com.inhabas.api.domain.contest.dto; -import java.time.LocalDate; import java.time.LocalDateTime; import java.util.List; @@ -41,11 +40,15 @@ public class ContestBoardDetailDto { private List otherFiles; - @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd") - private LocalDate dateContestStart; + @NotNull + @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd'T'HH:mm:ss") + @Schema(type = "string", example = "2024-11-01T00:00:00") + private LocalDateTime dateContestStart; - @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd") - private LocalDate dateContestEnd; + @NotNull + @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd'T'HH:mm:ss") + @Schema(type = "string", example = "2024-11-01T00:00:00") + private LocalDateTime dateContestEnd; @NotNull @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd'T'HH:mm:ss") @@ -66,8 +69,8 @@ public ContestBoardDetailDto( String writerName, String association, String topic, - LocalDate dateContestStart, - LocalDate dateContestEnd, + LocalDateTime dateContestStart, + LocalDateTime dateContestEnd, LocalDateTime dateCreated, LocalDateTime dateUpdated, FileDownloadDto thumbnail, diff --git a/resource-server/src/main/java/com/inhabas/api/domain/contest/dto/SaveContestBoardDto.java b/resource-server/src/main/java/com/inhabas/api/domain/contest/dto/SaveContestBoardDto.java index 1479b906..0181f8ae 100644 --- a/resource-server/src/main/java/com/inhabas/api/domain/contest/dto/SaveContestBoardDto.java +++ b/resource-server/src/main/java/com/inhabas/api/domain/contest/dto/SaveContestBoardDto.java @@ -1,6 +1,6 @@ package com.inhabas.api.domain.contest.dto; -import java.time.LocalDate; +import java.time.LocalDateTime; import java.util.ArrayList; import java.util.List; @@ -12,6 +12,8 @@ import lombok.Getter; import lombok.NoArgsConstructor; +import com.fasterxml.jackson.annotation.JsonFormat; +import io.swagger.v3.oas.annotations.media.Schema; import org.hibernate.validator.constraints.Length; // 공모전 게시판 글 업데이트 및 저장 @@ -38,11 +40,15 @@ public class SaveContestBoardDto { private String topic; @NotNull(message = "공모전 모집 시작일을 등록해주세요.") - private LocalDate dateContestStart; + @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd'T'HH:mm:ss") + @Schema(type = "string", example = "2024-11-01T00:00:00") + private LocalDateTime dateContestStart; @NotNull(message = "공모전 모집 마감일을 등록해주세요.") + @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd'T'HH:mm:ss") + @Schema(type = "string", example = "2024-11-01T00:00:00") @Future(message = "이미 모집기간이 종료된 공모전은 등록할 수 없습니다.") - private LocalDate dateContestEnd; + private LocalDateTime dateContestEnd; private List files = new ArrayList<>(); @@ -53,8 +59,8 @@ public SaveContestBoardDto( String content, String association, String topic, - LocalDate dateContestStart, - LocalDate dateContestEnd, + LocalDateTime dateContestStart, + LocalDateTime dateContestEnd, List files) { this.contestFieldId = contestFieldId; diff --git a/resource-server/src/test/java/com/inhabas/api/domain/contest/domain/ContestBoardTest.java b/resource-server/src/test/java/com/inhabas/api/domain/contest/domain/ContestBoardTest.java index 6db3cdbb..5f8bc6a2 100644 --- a/resource-server/src/test/java/com/inhabas/api/domain/contest/domain/ContestBoardTest.java +++ b/resource-server/src/test/java/com/inhabas/api/domain/contest/domain/ContestBoardTest.java @@ -3,7 +3,7 @@ import static org.assertj.core.api.Assertions.assertThat; import static org.mockito.Mockito.when; -import java.time.LocalDate; +import java.time.LocalDateTime; import java.util.ArrayList; import java.util.List; @@ -36,8 +36,8 @@ void setUp() { String content = "테스트 내용"; String association = "테스트 협회"; String topic = "테스트 주제"; - LocalDate dateContestStart = LocalDate.of(2023, 1, 1); - LocalDate dateContestEnd = LocalDate.of(2023, 12, 31); + LocalDateTime dateContestStart = LocalDateTime.of(2023, 1, 1, 0, 0, 0); + LocalDateTime dateContestEnd = LocalDateTime.of(2023, 12, 31, 0, 0, 0); when(contestField.getId()).thenReturn(contestFieldId); @@ -63,8 +63,8 @@ void createContestBoardTest() { assertThat(contestBoard.getContent()).isEqualTo("테스트 내용"); assertThat(contestBoard.getAssociation()).isEqualTo("테스트 협회"); assertThat(contestBoard.getTopic()).isEqualTo("테스트 주제"); - assertThat(contestBoard.getDateContestStart()).isEqualTo(LocalDate.of(2023, 1, 1)); - assertThat(contestBoard.getDateContestEnd()).isEqualTo(LocalDate.of(2023, 12, 31)); + assertThat(contestBoard.getDateContestStart()).isEqualTo(LocalDateTime.of(2023, 1, 1, 0, 0, 0)); + assertThat(contestBoard.getDateContestEnd()).isEqualTo(LocalDateTime.of(2023, 12, 31, 0, 0, 0)); } @Test @@ -78,8 +78,8 @@ void updateContestBoardTest() { String newContent = "새로운 내용"; String newAssociation = "새로운 협회"; String newTopic = "새로운 주제"; - LocalDate newDateContestStart = LocalDate.now(); - LocalDate newDateContestEnd = LocalDate.now().plusDays(30); + LocalDateTime newDateContestStart = LocalDateTime.now(); + LocalDateTime newDateContestEnd = LocalDateTime.now().plusDays(30); ContestField newContestField = new ContestField("새로운 분야"); ReflectionTestUtils.setField(newContestField, "id", newContestFieldId); diff --git a/resource-server/src/test/java/com/inhabas/api/domain/contest/dto/SaveContestBoardDtoTest.java b/resource-server/src/test/java/com/inhabas/api/domain/contest/dto/SaveContestBoardDtoTest.java index 93db9774..05eaeeb9 100644 --- a/resource-server/src/test/java/com/inhabas/api/domain/contest/dto/SaveContestBoardDtoTest.java +++ b/resource-server/src/test/java/com/inhabas/api/domain/contest/dto/SaveContestBoardDtoTest.java @@ -1,6 +1,6 @@ package com.inhabas.api.domain.contest.dto; -import java.time.LocalDate; +import java.time.LocalDateTime; import java.util.ArrayList; import java.util.List; import java.util.Set; @@ -93,8 +93,8 @@ public void InputsAreExceededError() { "content! Cucumber paste has to have a sun-dried, chilled sauerkraut component.", "Assoc".repeat(20) + ".", "topic".repeat(100) + ".", - LocalDate.of(2022, 1, 1), - LocalDate.of(9999, 3, 3), + LocalDateTime.of(2022, 1, 1, 0, 0, 0), + LocalDateTime.of(9999, 3, 3, 0, 0, 0), null); // when @@ -121,8 +121,8 @@ public void DeadlineIsOutdatedError() { "content", "association", "topic", - LocalDate.of(2022, 1, 1), - LocalDate.of(2022, 2, 1), + LocalDateTime.of(2022, 1, 1, 0, 0, 0), + LocalDateTime.of(2022, 2, 1, 0, 0, 0), null); // when From 629ff0e68959673d2fc86ab9d5b3d561171a7fd4 Mon Sep 17 00:00:00 2001 From: skytin1004 Date: Sun, 31 Mar 2024 18:57:00 +0900 Subject: [PATCH 2/3] =?UTF-8?q?[refactor/Inhabas#273]=20=EA=B3=B5=EB=AA=A8?= =?UTF-8?q?=EC=A0=84=20=EA=B2=8C=EC=8B=9C=ED=8C=90=20=EC=8B=9C=EC=9E=91?= =?UTF-8?q?=EC=9D=BC=20=EB=B0=8F=20=EC=A2=85=EB=A3=8C=EC=9D=BC=20LocalDate?= =?UTF-8?q?Time=EC=9C=BC=EB=A1=9C=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../domain/contest/dto/ContestBoardDto.java | 16 ++++++---- .../domain/ContestBoardExampleTest.java | 18 +++++------ .../dto/ContestBoardDetailDtoTest.java | 9 +++--- .../contest/dto/ContestBoardDtoTest.java | 5 +-- .../usecase/ContestBoardServiceImplTest.java | 31 ++++++++++--------- .../api/web/ContestBoardControllerTest.java | 29 +++++++++-------- 6 files changed, 56 insertions(+), 52 deletions(-) diff --git a/resource-server/src/main/java/com/inhabas/api/domain/contest/dto/ContestBoardDto.java b/resource-server/src/main/java/com/inhabas/api/domain/contest/dto/ContestBoardDto.java index a2b446a8..7012624a 100644 --- a/resource-server/src/main/java/com/inhabas/api/domain/contest/dto/ContestBoardDto.java +++ b/resource-server/src/main/java/com/inhabas/api/domain/contest/dto/ContestBoardDto.java @@ -1,6 +1,7 @@ package com.inhabas.api.domain.contest.dto; import java.time.LocalDate; +import java.time.LocalDateTime; import java.time.temporal.ChronoUnit; import lombok.Builder; @@ -10,6 +11,7 @@ import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonProperty; import com.inhabas.api.domain.file.dto.FileDownloadDto; +import io.swagger.v3.oas.annotations.media.Schema; // 공모전 게시판 전체 조회 @Getter @@ -22,11 +24,13 @@ public class ContestBoardDto { private String topic; private String association; - @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd") - private LocalDate dateContestStart; + @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd'T'HH:mm:ss") + @Schema(type = "string", example = "2024-11-01T00:00:00") + private LocalDateTime dateContestStart; - @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd") - private LocalDate dateContestEnd; + @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd'T'HH:mm:ss") + @Schema(type = "string", example = "2024-11-01T00:00:00") + private LocalDateTime dateContestEnd; @JsonProperty("D-day") private long dDay; @@ -40,8 +44,8 @@ public ContestBoardDto( String title, String topic, String association, - LocalDate dateContestStart, - LocalDate dateContestEnd, + LocalDateTime dateContestStart, + LocalDateTime dateContestEnd, FileDownloadDto thumbnail) { this.id = id; this.contestFieldId = contestFieldId; diff --git a/resource-server/src/test/java/com/inhabas/api/domain/contest/domain/ContestBoardExampleTest.java b/resource-server/src/test/java/com/inhabas/api/domain/contest/domain/ContestBoardExampleTest.java index 4c3cf86f..e64ce56a 100644 --- a/resource-server/src/test/java/com/inhabas/api/domain/contest/domain/ContestBoardExampleTest.java +++ b/resource-server/src/test/java/com/inhabas/api/domain/contest/domain/ContestBoardExampleTest.java @@ -1,6 +1,6 @@ package com.inhabas.api.domain.contest.domain; -import java.time.LocalDate; +import java.time.LocalDateTime; import org.springframework.test.util.ReflectionTestUtils; @@ -16,8 +16,8 @@ public static ContestBoard getBoard1(Menu menu, ContestField contestField) { .content("테스트 내용1") .association("(주) 아이바스1") .topic("테스트 주제1") - .dateContestStart(LocalDate.now()) - .dateContestEnd(LocalDate.now().plusDays(10)) + .dateContestStart(LocalDateTime.now()) + .dateContestEnd(LocalDateTime.now().plusDays(10)) .build(); return contestBoard; } @@ -31,8 +31,8 @@ public static ContestBoard getBoard2(Menu menu, ContestField contestField) { .content("테스트 내용2") .association("(주) 아이바스2") .topic("테스트 주제2") - .dateContestStart(LocalDate.now()) - .dateContestEnd(LocalDate.now().plusDays(10)) + .dateContestStart(LocalDateTime.now()) + .dateContestEnd(LocalDateTime.now().plusDays(10)) .build(); return contestBoard; } @@ -46,8 +46,8 @@ public static ContestBoard getBoard3(Menu menu, ContestField contestField) { .content("테스트 내용3") .association("(주) 아이바스3") .topic("테스트 주제3") - .dateContestStart(LocalDate.now()) - .dateContestEnd(LocalDate.now().plusDays(10)) + .dateContestStart(LocalDateTime.now()) + .dateContestEnd(LocalDateTime.now().plusDays(10)) .build(); return contestBoard; } @@ -62,8 +62,8 @@ public static ContestBoard getTestBoard(Integer id, Menu menu, ContestField cont .content("테스트 내용1") .association("(주) 아이바스1") .topic("테스트 주제1") - .dateContestStart(LocalDate.now()) - .dateContestEnd(LocalDate.now().plusDays(10)) + .dateContestStart(LocalDateTime.now()) + .dateContestEnd(LocalDateTime.now().plusDays(10)) .build(); ReflectionTestUtils.setField(contestBoard, "id", id); return contestBoard; diff --git a/resource-server/src/test/java/com/inhabas/api/domain/contest/dto/ContestBoardDetailDtoTest.java b/resource-server/src/test/java/com/inhabas/api/domain/contest/dto/ContestBoardDetailDtoTest.java index cf17b5cb..b9d04c1e 100644 --- a/resource-server/src/test/java/com/inhabas/api/domain/contest/dto/ContestBoardDetailDtoTest.java +++ b/resource-server/src/test/java/com/inhabas/api/domain/contest/dto/ContestBoardDetailDtoTest.java @@ -2,7 +2,6 @@ import static org.assertj.core.api.Assertions.assertThat; -import java.time.LocalDate; import java.time.LocalDateTime; import java.util.ArrayList; import java.util.Set; @@ -48,8 +47,8 @@ public void createContestBoardDetailDto() { .writerName("송민석") .association("(주) 아이바스") .topic("테스트 주제") - .dateContestStart(LocalDate.now()) - .dateContestEnd(LocalDate.now().plusDays(10)) + .dateContestStart(LocalDateTime.now()) + .dateContestEnd(LocalDateTime.now().plusDays(10)) .dateCreated(LocalDateTime.now()) .dateUpdated(LocalDateTime.now()) .thumbnail( @@ -79,8 +78,8 @@ public void nullTitleTest() { .writerName("송민석") .association("(주) 아이바스") .topic("테스트 주제") - .dateContestStart(LocalDate.now()) - .dateContestEnd(LocalDate.now().plusDays(10)) + .dateContestStart(LocalDateTime.now()) + .dateContestEnd(LocalDateTime.now().plusDays(10)) .dateCreated(LocalDateTime.now()) .dateUpdated(LocalDateTime.now()) .thumbnail( diff --git a/resource-server/src/test/java/com/inhabas/api/domain/contest/dto/ContestBoardDtoTest.java b/resource-server/src/test/java/com/inhabas/api/domain/contest/dto/ContestBoardDtoTest.java index 227f6fe9..c94e4870 100644 --- a/resource-server/src/test/java/com/inhabas/api/domain/contest/dto/ContestBoardDtoTest.java +++ b/resource-server/src/test/java/com/inhabas/api/domain/contest/dto/ContestBoardDtoTest.java @@ -3,6 +3,7 @@ import static org.assertj.core.api.Assertions.assertThat; import java.time.LocalDate; +import java.time.LocalDateTime; import com.inhabas.api.domain.file.dto.FileDownloadDto; @@ -21,8 +22,8 @@ public void createContestBoardDto() { String title = "테스트 제목"; String topic = "테스트 주제"; String association = "테스트 협회"; - LocalDate dateContestStart = LocalDate.of(2024, 1, 1); - LocalDate dateContestEnd = LocalDate.of(2024, 3, 1); + LocalDateTime dateContestStart = LocalDateTime.of(2024, 1, 1, 0, 0, 0); + LocalDateTime dateContestEnd = LocalDateTime.of(2024, 3, 1, 0, 0, 0); FileDownloadDto thumbnail = new FileDownloadDto("random", "thumbnail.jpg", "/thumbnailUrl", 10L, "image/jpeg"); diff --git a/resource-server/src/test/java/com/inhabas/api/domain/contest/usecase/ContestBoardServiceImplTest.java b/resource-server/src/test/java/com/inhabas/api/domain/contest/usecase/ContestBoardServiceImplTest.java index c34643bf..d0bbdb11 100644 --- a/resource-server/src/test/java/com/inhabas/api/domain/contest/usecase/ContestBoardServiceImplTest.java +++ b/resource-server/src/test/java/com/inhabas/api/domain/contest/usecase/ContestBoardServiceImplTest.java @@ -14,7 +14,7 @@ import static org.mockito.Mockito.doNothing; import static org.mockito.Mockito.times; -import java.time.LocalDate; +import java.time.LocalDateTime; import java.util.ArrayList; import java.util.List; import java.util.Optional; @@ -73,8 +73,8 @@ void getContestBoards() { .title("테스트 제목") .association("(주) 아이바스") .topic("테스트 주제") - .dateContestStart(LocalDate.now()) - .dateContestEnd(LocalDate.now().plusDays(10)) + .dateContestStart(LocalDateTime.now()) + .dateContestEnd(LocalDateTime.now().plusDays(10)) .thumbnail( new FileDownloadDto("random", "thumbnail.jpg", "/thumbnailUrl", 10L, "image/jpeg")) .build(); @@ -109,8 +109,8 @@ void getContestBoard() { .content("테스트 내용") .association("(주) 아이바스") .topic("테스트 주제") - .dateContestStart(LocalDate.now()) - .dateContestEnd(LocalDate.now().plusDays(10)) + .dateContestStart(LocalDateTime.of(2024, 1, 1, 0, 0, 0)) + .dateContestEnd(LocalDateTime.of(2024, 1, 1, 0, 0, 0).plusDays(10)) .build() .writtenBy(member, ContestBoard.class); @@ -126,8 +126,9 @@ void getContestBoard() { assertThat(dto.getContent()).isEqualTo("테스트 내용"); assertThat(dto.getAssociation()).isEqualTo("(주) 아이바스"); assertThat(dto.getTopic()).isEqualTo("테스트 주제"); - assertThat(dto.getDateContestStart()).isEqualTo(LocalDate.now()); - assertThat(dto.getDateContestEnd()).isEqualTo(LocalDate.now().plusDays(10)); + assertThat(dto.getDateContestStart()).isEqualTo(LocalDateTime.of(2024, 1, 1, 0, 0, 0)); + assertThat(dto.getDateContestEnd()) + .isEqualTo(LocalDateTime.of(2024, 1, 1, 0, 0, 0).plusDays(10)); } @DisplayName("Contest board 게시글을 작성한다.") @@ -146,8 +147,8 @@ void writeContestBoard() { .content("테스트 내용") .association("(주) 아이바스") .topic("테스트 주제") - .dateContestStart(LocalDate.now()) - .dateContestEnd(LocalDate.now().plusDays(10)) + .dateContestStart(LocalDateTime.now()) + .dateContestEnd(LocalDateTime.now().plusDays(10)) .files(null) .build(); @@ -160,8 +161,8 @@ void writeContestBoard() { .content("테스트 내용") .association("(주) 아이바스") .topic("테스트 주제") - .dateContestStart(LocalDate.now()) - .dateContestEnd(LocalDate.now().plusDays(10)) + .dateContestStart(LocalDateTime.now()) + .dateContestEnd(LocalDateTime.now().plusDays(10)) .build() .writtenBy(member, ContestBoard.class); @@ -193,8 +194,8 @@ void updateContestBoard() { .content("테스트 내용") .association("(주) 아이바스") .topic("테스트 주제") - .dateContestStart(LocalDate.now()) - .dateContestEnd(LocalDate.now().plusDays(10)) + .dateContestStart(LocalDateTime.now()) + .dateContestEnd(LocalDateTime.now().plusDays(10)) .files(null) .build(); @@ -208,8 +209,8 @@ void updateContestBoard() { .content("테스트 내용") .association("(주) 아이바스") .topic("테스트 주제") - .dateContestStart(LocalDate.now()) - .dateContestEnd(LocalDate.now().plusDays(10)) + .dateContestStart(LocalDateTime.now()) + .dateContestEnd(LocalDateTime.now().plusDays(10)) .build(); ReflectionTestUtils.setField(contestBoard, "id", 1L); diff --git a/resource-server/src/test/java/com/inhabas/api/web/ContestBoardControllerTest.java b/resource-server/src/test/java/com/inhabas/api/web/ContestBoardControllerTest.java index 7c1d25df..1b4b7351 100644 --- a/resource-server/src/test/java/com/inhabas/api/web/ContestBoardControllerTest.java +++ b/resource-server/src/test/java/com/inhabas/api/web/ContestBoardControllerTest.java @@ -14,7 +14,6 @@ import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; import java.nio.charset.StandardCharsets; -import java.time.LocalDate; import java.time.LocalDateTime; import java.util.List; @@ -88,8 +87,8 @@ void getBoardList_Success() throws Exception { .title("테스트 제목") .topic("테스트 주제") .association("테스트 협회") - .dateContestStart(LocalDate.of(2024, 1, 1)) - .dateContestEnd(LocalDate.of(2024, 3, 1)) + .dateContestStart(LocalDateTime.of(2024, 1, 1, 0, 0, 0)) + .dateContestEnd(LocalDateTime.of(2024, 3, 1, 0, 0, 0)) .thumbnail( new FileDownloadDto("random", "thumbnail.jpg", "/thumbnailUrl", 10L, "image/jpeg")) .build(); @@ -143,8 +142,8 @@ void getBoard() throws Exception { .writerName(writer.getName()) .association("테스트 협회") .topic("테스트 주제") - .dateContestStart(LocalDate.of(2024, 1, 1)) - .dateContestEnd(LocalDate.of(2024, 3, 1)) + .dateContestStart(LocalDateTime.of(2024, 1, 1, 0, 0, 0)) + .dateContestEnd(LocalDateTime.of(2024, 3, 1, 0, 0, 0)) .dateCreated(LocalDateTime.now()) .dateUpdated(LocalDateTime.now()) .thumbnail( @@ -212,8 +211,8 @@ void addBoard() throws Exception { .content("good content") .association("good association") .topic("good topic") - .dateContestStart(LocalDate.now()) - .dateContestEnd(LocalDate.now().plusDays(10)) + .dateContestStart(LocalDateTime.now()) + .dateContestEnd(LocalDateTime.now().plusDays(10)) .build(); // when @@ -244,8 +243,8 @@ void addBoard_Invalid_Input() throws Exception { .content("good content") .association("good association") .topic("good topic") - .dateContestStart(LocalDate.now()) - .dateContestEnd(LocalDate.now().plusDays(10)) + .dateContestStart(LocalDateTime.now()) + .dateContestEnd(LocalDateTime.now().plusDays(10)) .build(); String saveContestBoardDtoJson = objectMapper.writeValueAsString(saveContestBoardDto); @@ -279,8 +278,8 @@ void updateBoard() throws Exception { .content("good content") .association("good association") .topic("good topic") - .dateContestStart(LocalDate.now()) - .dateContestEnd(LocalDate.now().plusDays(10)) + .dateContestStart(LocalDateTime.now()) + .dateContestEnd(LocalDateTime.now().plusDays(10)) .build(); // when then @@ -307,8 +306,8 @@ void updateBoard_Invalid_Input() throws Exception { .content("good content") .association("good association") .topic("good topic") - .dateContestStart(LocalDate.now()) - .dateContestEnd(LocalDate.now().plusDays(10)) + .dateContestStart(LocalDateTime.now()) + .dateContestEnd(LocalDateTime.now().plusDays(10)) .build(); // when @@ -341,8 +340,8 @@ void updateBoard_Not_Found() throws Exception { .content("good content") .association("good association") .topic("good topic") - .dateContestStart(LocalDate.now()) - .dateContestEnd(LocalDate.now().plusDays(10)) + .dateContestStart(LocalDateTime.now()) + .dateContestEnd(LocalDateTime.now().plusDays(10)) .build(); // when From 082e0107d6525bbec0d767650f192890e274cfe7 Mon Sep 17 00:00:00 2001 From: skytin1004 Date: Sun, 31 Mar 2024 19:00:01 +0900 Subject: [PATCH 3/3] =?UTF-8?q?[refactor/Inhabas#273]=20=EB=A9=94=EB=89=B4?= =?UTF-8?q?=20description=20=EA=B8=B8=EC=9D=B4=20=EC=A0=9C=ED=95=9C=20?= =?UTF-8?q?=EA=B4=80=EB=A0=A8=20=ED=85=8C=EC=8A=A4=ED=8A=B8=20=EC=BD=94?= =?UTF-8?q?=EB=93=9C=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../domain/valueObject/MenuCategoryDescriptionTest.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/resource-server/src/test/java/com/inhabas/api/domain/menu/domain/valueObject/MenuCategoryDescriptionTest.java b/resource-server/src/test/java/com/inhabas/api/domain/menu/domain/valueObject/MenuCategoryDescriptionTest.java index 2973cec6..d525987c 100644 --- a/resource-server/src/test/java/com/inhabas/api/domain/menu/domain/valueObject/MenuCategoryDescriptionTest.java +++ b/resource-server/src/test/java/com/inhabas/api/domain/menu/domain/valueObject/MenuCategoryDescriptionTest.java @@ -22,17 +22,17 @@ public void CategoryName_cannot_be_blank() { Assertions.assertThrows(IllegalArgumentException.class, () -> new Description(" ")); } - @DisplayName("게시판 설명 50글자 이상은 허용 안됨.") + @DisplayName("게시판 설명 100글자 이상은 허용 안됨.") @Test public void CategoryName_too_long() { // given - String description = "이문장7글자임".repeat(7); + String description = "이문장은11글자입니다".repeat(9); - // when : 49글자 정상 저장 + // when : 99글자 정상 저장 Description categoryName = new Description(description); assertThat(categoryName.getValue()).isEqualTo(description); - // when : 50글자 저장 안됨. + // when : 100글자 저장 안됨. Assertions.assertThrows( IllegalArgumentException.class, () -> new Description(description + ".")); }