From f29807349de959312bd3366c8aafcd3fd569e08b Mon Sep 17 00:00:00 2001 From: hong-sile Date: Sat, 13 Jan 2024 02:58:07 +0900 Subject: [PATCH] =?UTF-8?q?test:=20EventCommandServiceTest=20=EC=98=A4?= =?UTF-8?q?=EB=A5=98=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit #893 --- .../application/EventCommandServiceTest.java | 28 +++++++++---------- 1 file changed, 14 insertions(+), 14 deletions(-) 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