Skip to content

Commit

Permalink
feat: 깨진 테스트 해결
Browse files Browse the repository at this point in the history
  • Loading branch information
Daolove0323 committed Nov 9, 2024
1 parent 65cf9f3 commit db48b9e
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 28 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -176,8 +176,8 @@ public static Event createValidEvent() {
.endTime(LocalDateTime.now())
.price(10000)
.totalSeat(100)
.images(List.of())
.category(Category.밴드)
.images(List.of())
.build();
ReflectionTestUtils.setField(validEvent, "id", 1L);
validEvent.setHost(MemberDomain.createValidHost());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@
import org.ktc2.cokaen.wouldyouin._common.vo.Area;
import org.ktc2.cokaen.wouldyouin._common.vo.Category;
import org.ktc2.cokaen.wouldyouin._global.TestData.EventDomain;
import org.ktc2.cokaen.wouldyouin.event.api.dto.LocationFilter;
import org.ktc2.cokaen.wouldyouin.event.api.dto.EventCreateRequest;
import org.ktc2.cokaen.wouldyouin.event.api.dto.EventEditRequest;
import org.ktc2.cokaen.wouldyouin.event.api.dto.LocationFilter;
import org.ktc2.cokaen.wouldyouin.event.api.dto.UserLocation;
import org.ktc2.cokaen.wouldyouin.event.application.EventService;
import org.ktc2.cokaen.wouldyouin.event.persist.Event;
Expand Down Expand Up @@ -145,32 +145,32 @@ void create() {
then(eventRepository).should(times(1)).save(any(Event.class));
}

// @Test
// @DisplayName("행사 id를 통한 행사 수정 - 성공")
// void update() {
// // given
// Long eventId = validEvent.getId();
// Long hostId = validEvent.getHost().getId();
// EventEditRequest validEventEditRequest = EventDomain.createValidEventEditRequest();
// given(eventRepository.findById(eventId)).willReturn(Optional.of(validEvent));
//
// // when
// eventService.update(hostId, eventId, validEventEditRequest);
//
// // then
// then(eventRepository).should(times(1)).findById(eventId);
// assertAll(
// () -> assertEquals(validEvent.getTitle(), validEventEditRequest.getTitle()),
// () -> assertEquals(validEvent.getContent(), validEventEditRequest.getContent()),
// () -> assertEquals(validEvent.getArea(), validEventEditRequest.getArea()),
// () -> assertEquals(validEvent.getLocation(), validEventEditRequest.getLocation()),
// () -> assertEquals(validEvent.getStartTime(), validEventEditRequest.getStartTime()),
// () -> assertEquals(validEvent.getEndTime(), validEventEditRequest.getEndTime()),
// () -> assertEquals(validEvent.getPrice(), validEventEditRequest.getPrice()),
// () -> assertEquals(validEvent.getTotalSeat(), validEventEditRequest.getTotalSeat()),
// () -> assertEquals(validEvent.getCategory(), validEventEditRequest.getCategory())
// );
// }
@Test
@DisplayName("행사 id를 통한 행사 수정 - 성공")
void update() {
// given
Long eventId = validEvent.getId();
Long hostId = validEvent.getHost().getId();
EventEditRequest validEventEditRequest = EventDomain.createValidEventEditRequest();
given(eventRepository.findById(eventId)).willReturn(Optional.of(validEvent));

// when
eventService.update(hostId, eventId, validEventEditRequest);

// then
then(eventRepository).should(times(1)).findById(eventId);
assertAll(
() -> assertEquals(validEvent.getTitle(), validEventEditRequest.getTitle()),
() -> assertEquals(validEvent.getContent(), validEventEditRequest.getContent()),
() -> assertEquals(validEvent.getArea(), validEventEditRequest.getArea()),
() -> assertEquals(validEvent.getLocation(), validEventEditRequest.getLocation()),
() -> assertEquals(validEvent.getStartTime(), validEventEditRequest.getStartTime()),
() -> assertEquals(validEvent.getEndTime(), validEventEditRequest.getEndTime()),
() -> assertEquals(validEvent.getPrice(), validEventEditRequest.getPrice()),
() -> assertEquals(validEvent.getTotalSeat(), validEventEditRequest.getTotalSeat()),
() -> assertEquals(validEvent.getCategory(), validEventEditRequest.getCategory())
);
}

@Test
@DisplayName("유효하지 않은 행사 id를 통한 행사 수정 - 실패")
Expand Down

0 comments on commit db48b9e

Please sign in to comment.