diff --git a/backend/emm-sale/src/test/java/com/emmsale/admin/event/application/EventCommandServiceTest.java b/backend/emm-sale/src/test/java/com/emmsale/admin/event/application/EventCommandServiceTest.java index 4d548ae6f..fee2afedd 100644 --- a/backend/emm-sale/src/test/java/com/emmsale/admin/event/application/EventCommandServiceTest.java +++ b/backend/emm-sale/src/test/java/com/emmsale/admin/event/application/EventCommandServiceTest.java @@ -160,6 +160,13 @@ void addEventTest() { final Event savedEvent = eventRepository.findById(response.getId()).get(); //then + assertThat(response.getTags()) + .extracting("name") + .containsExactlyInAnyOrderElementsOf( + tagRequests.stream() + .map(TagRequest::getName) + .collect(Collectors.toList()) + ); assertAll( () -> assertEquals(eventName, savedEvent.getName()), () -> assertEquals(eventLocation, savedEvent.getLocation()), @@ -167,13 +174,6 @@ void addEventTest() { () -> assertEquals(beforeDateTime, savedEvent.getEventPeriod().getStartDate()), () -> assertEquals(afterDateTime, savedEvent.getEventPeriod().getEndDate()) ); - assertThat(response.getTags()) - .extracting("name") - .containsExactlyInAnyOrder( - tagRequests.stream() - .map(TagRequest::getName) - .collect(Collectors.toList()) - ); } @Test @@ -320,6 +320,13 @@ void updateEventTest() { final Event updatedEvent = eventRepository.findById(eventId).get(); //then + assertThat(response.getTags()) + .extracting("name") + .containsExactlyInAnyOrderElementsOf( + newTagRequests.stream() + .map(TagRequest::getName) + .collect(Collectors.toList()) + ); assertAll( () -> assertEquals(newName, updatedEvent.getName()), () -> assertEquals(newLocation, updatedEvent.getLocation()), @@ -327,13 +334,6 @@ void updateEventTest() { () -> assertEquals(newEndDateTime, updatedEvent.getEventPeriod().getEndDate()), () -> assertEquals(newInformationUrl, updatedEvent.getInformationUrl()) ); - assertThat(response.getTags()) - .extracting("name") - .containsExactlyInAnyOrder( - newTagRequests.stream() - .map(TagRequest::getName) - .collect(Collectors.toList()) - ); } @Test