Skip to content

Commit

Permalink
refactor: ControllerTest RestDocs에 맞게 필드 추가
Browse files Browse the repository at this point in the history
  • Loading branch information
jjongwa committed Jul 27, 2023
1 parent c190ca0 commit 3624a34
Showing 1 changed file with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import com.fasterxml.jackson.databind.ObjectMapper;
import hanglog.trip.dto.request.ExpenseRequest;
import hanglog.trip.dto.request.ItemRequest;
import hanglog.trip.dto.request.ItemUpdateRequest;
import hanglog.trip.dto.request.PlaceRequest;
import hanglog.trip.restdocs.RestDocsTest;
import hanglog.trip.service.ItemService;
Expand Down Expand Up @@ -155,13 +156,14 @@ void updateItem() throws Exception {

final ExpenseRequest expenseRequest = new ExpenseRequest("EURO", 10000.0, 1L);

final ItemRequest itemRequest = new ItemRequest(
final ItemUpdateRequest itemUpdateRequest = new ItemUpdateRequest(
true,
"에펠탑",
4.5,
"에펠탑을 방문",
1L,
List.of("imageUrl"),
true,
placeRequest,
expenseRequest
);
Expand All @@ -171,7 +173,7 @@ void updateItem() throws Exception {
// when & then
mockMvc.perform(put("/trips/{tripId}/items/{itemId}", 1L, 1L)
.contentType(MediaType.APPLICATION_JSON)
.content(objectMapper.writeValueAsString(itemRequest)))
.content(objectMapper.writeValueAsString(itemUpdateRequest)))
.andExpect(status().isNoContent())
.andDo(
restDocs.document(
Expand Down Expand Up @@ -206,6 +208,10 @@ void updateItem() throws Exception {
.type(JsonFieldType.ARRAY)
.description("여행 아이템 이미지 URL 배열")
.attributes(field("constraint", "URL 배열")),
fieldWithPath("isPlaceUpdated")
.type(JsonFieldType.BOOLEAN)
.description("여행 수정 여부")
.attributes(field("constraint", "True: 여행 수정됨, False: 여행 수정 안됨")),
fieldWithPath("place.name")
.type(JsonFieldType.STRING)
.description("장소 이름")
Expand Down

0 comments on commit 3624a34

Please sign in to comment.