diff --git a/BE/airbnb-be/src/test/java/com/codesquad/airbnb/accommodation/service/AccommodationServiceImplTest.java b/BE/airbnb-be/src/test/java/com/codesquad/airbnb/accommodation/service/AccommodationServiceImplTest.java index d8e9ed676..da43c8d52 100644 --- a/BE/airbnb-be/src/test/java/com/codesquad/airbnb/accommodation/service/AccommodationServiceImplTest.java +++ b/BE/airbnb-be/src/test/java/com/codesquad/airbnb/accommodation/service/AccommodationServiceImplTest.java @@ -1,10 +1,12 @@ package com.codesquad.airbnb.accommodation.service; +import com.codesquad.airbnb.accommodation.controller.AccommodationDTO; import com.codesquad.airbnb.accommodation.controller.AccommodationRequest; import com.codesquad.airbnb.accommodation.controller.AccommodationReservationInfo; import com.codesquad.airbnb.accommodation.controller.AccommodationResponse; import com.codesquad.airbnb.accommodation.domain.Accommodation; import com.codesquad.airbnb.accommodation.repository.AccommodationRepository; +import com.codesquad.airbnb.common.dummydata.AccommodationDTODummyDataFactory; import com.codesquad.airbnb.common.dummydata.AccommodationDummyDataFactory; import com.codesquad.airbnb.common.dummydata.AccommodationReservationInfoDummyDataFactory; import com.codesquad.airbnb.common.dummydata.AccommodationResponseDummyDataFactory; @@ -65,6 +67,28 @@ static Stream readAllProvider() { ); } + @ParameterizedTest + @MethodSource("readOneProvider") + void readOne(long id, Accommodation given, AccommodationDTO expected) { + given(accommodationRepository.findOne(id)) + .willReturn(given); + + AccommodationDTO actual = accommodationService.readOne(id); + + then(actual).isEqualTo(expected); + } + + @SuppressWarnings("unused") + static Stream readOneProvider() { + return Stream.of( + Arguments.of( + 1L, + AccommodationDummyDataFactory.listWithId().get(0), + AccommodationDTODummyDataFactory.listWithId().get(0) + ) + ); + } + @ParameterizedTest @MethodSource("accommodationReservationInfoProvider") void accommodationReservationInfo(long id, Accommodation given, AccommodationRequest accommodationRequest, AccommodationReservationInfo expected) {