@@ -179,10 +179,50 @@ void createEventFailWhenPreCloseAtAfterTicketOpenAt() {
179179 // @DisplayName("사전등록 시작일이 과거이면 예외 발생")
180180 // void createEventFailWhenPreOpenAtIsBeforeNow() { ... }
181181
182- // 중복 체크 비활성화로 인해 테스트 제거됨
183- // @Test
184- // @DisplayName("중복된 이벤트 생성 시 예외 발생")
185- // void createEventFailWhenDuplicateEvent() { ... }
182+ @ Test
183+ @ DisplayName ("중복된 이벤트 생성 시 예외 발생" )
184+ void createEventFailWhenDuplicateEvent () {
185+ // given
186+ // 첫 번째 이벤트 생성
187+ eventRepository .save (Event .builder ()
188+ .title ("중복 테스트 이벤트" )
189+ .category (EventCategory .CONCERT )
190+ .description ("테스트 설명" )
191+ .place ("중복 장소" )
192+ .imageUrl ("https://example.com/image.jpg" )
193+ .minPrice (10000 )
194+ .maxPrice (50000 )
195+ .preOpenAt (preOpenAt )
196+ .preCloseAt (preCloseAt )
197+ .ticketOpenAt (ticketOpenAt )
198+ .ticketCloseAt (ticketCloseAt )
199+ .eventDate (eventDate )
200+ .maxTicketAmount (100 )
201+ .status (EventStatus .READY )
202+ .build ());
203+
204+ // 동일한 title, place, ticketOpenAt으로 이벤트 생성 시도
205+ EventCreateRequest request = new EventCreateRequest (
206+ "중복 테스트 이벤트" , // 동일한 title
207+ EventCategory .POPUP ,
208+ "다른 설명" ,
209+ "중복 장소" , // 동일한 place
210+ "https://example.com/image2.jpg" ,
211+ 20000 ,
212+ 80000 ,
213+ preOpenAt ,
214+ preCloseAt ,
215+ ticketOpenAt , // 동일한 ticketOpenAt
216+ ticketCloseAt ,
217+ eventDate ,
218+ 200
219+ );
220+
221+ // when & then
222+ assertThatThrownBy (() -> eventService .createEvent (request ))
223+ .isInstanceOf (ErrorException .class )
224+ .hasFieldOrPropertyWithValue ("errorCode" , EventErrorCode .DUPLICATE_EVENT );
225+ }
186226 }
187227
188228 @ Nested
@@ -327,9 +367,9 @@ void updateEventFailWhenDuplicateWithOtherEvent() {
327367 );
328368
329369 // when & then
330- // 중복 체크 비활성화로 인해 이제 성공해야 함
331- EventResponse response = eventService . updateEvent ( secondEvent . getId (), request );
332- assertThat ( response . title ()). isEqualTo ( "첫 번째 이벤트" );
370+ assertThatThrownBy (() -> eventService . updateEvent ( secondEvent . getId (), request ))
371+ . isInstanceOf ( ErrorException . class )
372+ . hasFieldOrPropertyWithValue ( "errorCode" , EventErrorCode . DUPLICATE_EVENT );
333373 }
334374
335375 @ Test
0 commit comments