diff --git a/BE/src/test/java/org/team4/airbnb/accommodation/AccommodationRepositoryTest.java b/BE/src/test/java/org/team4/airbnb/accommodation/AccommodationRepositoryTest.java index 70e35b09a..a1c6f4689 100644 --- a/BE/src/test/java/org/team4/airbnb/accommodation/AccommodationRepositoryTest.java +++ b/BE/src/test/java/org/team4/airbnb/accommodation/AccommodationRepositoryTest.java @@ -4,9 +4,12 @@ import java.util.List; import java.util.Set; +import java.util.stream.Stream; import org.junit.jupiter.api.DisplayName; import org.junit.jupiter.api.Nested; -import org.junit.jupiter.api.Test; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.Arguments; +import org.junit.jupiter.params.provider.MethodSource; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; @@ -21,21 +24,27 @@ @AutoConfigureTestDatabase(replace = AutoConfigureTestDatabase.Replace.NONE) class AccommodationRepositoryTest { - private static final Set SAMPLE_IDS = Set.of(3L, 4L, 5L); - @Autowired AccommodationRepository accommodationRepository; Logger logger = LoggerFactory.getLogger(AccommodationRepositoryTest.class); - @Test + @ParameterizedTest + @MethodSource("provideSampleIds") @DisplayName("숙소 Id 목록으로 사진이 포함된 숙소 목록 검색") - void findAllWithImagesById() { + void findAllWithImagesById(Set sampleIds) { List accommodations = accommodationRepository - .findAllWithImagesByIdIn(SAMPLE_IDS); + .findAllWithImagesByIdIn(sampleIds); accommodations.forEach(a -> logger.info(a.toString())); - assertThat(accommodations).hasSize(SAMPLE_IDS.size()); + assertThat(accommodations).hasSize(sampleIds.size()); + } + + private static Stream provideSampleIds() { + return Stream.of( + Arguments.of(Set.of(3L, 4L, 5L)), + Arguments.of(Set.of(1L, 5L, 8L, 10L)) + ); } }