Skip to content

Commit

Permalink
test: readOne 테스트 추가
Browse files Browse the repository at this point in the history
Dae-Hwa/airbnb/#45
  • Loading branch information
Dae-Hwa committed May 31, 2021
1 parent bf8b057 commit 8c6aeda
Showing 1 changed file with 24 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -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;
Expand Down Expand Up @@ -65,6 +67,28 @@ static Stream<Arguments> 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<Arguments> 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) {
Expand Down

0 comments on commit 8c6aeda

Please sign in to comment.