From 76878f90b4401240f790447e7614a05d63cd71b6 Mon Sep 17 00:00:00 2001 From: Photogrammer <81505228+JuneParkCode@users.noreply.github.com> Date: Mon, 12 Aug 2024 16:33:33 +0900 Subject: [PATCH] =?UTF-8?q?[FEAT]=20FE=20=ED=86=B5=ED=95=A9=EC=97=90=20?= =?UTF-8?q?=EB=94=B0=EB=A5=B8=20API=20=EB=B3=80=EA=B2=BD=20(#65)=20(#66)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## 작업 내용 - BusReviewRespDto 변경 - BusRouteStationRespDto 변경 --- .../bus/controller/BusRouteController.java | 21 ++- .../controller/BusRouteStationController.java | 40 ++--- .../bus/controller/BusStationController.java | 22 ++- .../server/bus/dao/BusRouteRepository.java | 2 +- .../bus/dao/BusRouteStationRepository.java | 6 +- .../bus/dto/BusRouteStationRespDto.java | 12 +- .../server/bus/service/BusRouteService.java | 14 +- .../bus/service/BusRouteStationService.java | 24 ++- .../server/bus/service/BusStationService.java | 12 +- .../controller/BusReviewController.java | 17 +- .../review/dao/BusReviewRepository.java | 12 +- .../server/review/dto/BusReviewRespDto.java | 6 + .../review/service/BusReviewService.java | 30 +++- .../com/talkka/server/bus/BusTestFactory.java | 7 +- .../controller/BusRouteControllerTest.java | 12 +- .../bus/service/BusRouteServiceTest.java | 44 ++++-- .../service/BusRouteStationServiceTest.java | 136 ++++++++-------- .../bus/service/BusStationServiceTest.java | 41 +++-- .../review/service/BusReviewServiceTest.java | 145 +++++++++++++++++- 19 files changed, 447 insertions(+), 156 deletions(-) diff --git a/server/src/main/java/com/talkka/server/bus/controller/BusRouteController.java b/server/src/main/java/com/talkka/server/bus/controller/BusRouteController.java index 395dbf93..11004317 100644 --- a/server/src/main/java/com/talkka/server/bus/controller/BusRouteController.java +++ b/server/src/main/java/com/talkka/server/bus/controller/BusRouteController.java @@ -6,6 +6,7 @@ import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; import com.talkka.server.bus.dto.BusRouteRespDto; @@ -21,24 +22,32 @@ public class BusRouteController { private final BusRouteService busRouteService; - @GetMapping("/name/{name}") - public ResponseEntity>> findByRouteName(@PathVariable("name") String routeName) { + @GetMapping("") + public ResponseEntity>> getRoutes( + @RequestParam(value = "search", required = false) String routeName) { + List routeList; + + if (routeName != null) { + routeList = busRouteService.getRoutesByRouteName(routeName); + } else { + routeList = busRouteService.getRoutes(); + } return ResponseEntity.ok( ApiRespDto.>builder() .statusCode(StatusCode.OK.getCode()) .message(StatusCode.OK.getMessage()) - .data(busRouteService.findByRouteName(routeName)) + .data(routeList) .build() ); } - @GetMapping("/id/{id}") - public ResponseEntity> findByRouteId(@PathVariable("id") Long routeId) { + @GetMapping("/{id}") + public ResponseEntity> getRouteById(@PathVariable("id") Long routeId) { return ResponseEntity.ok( ApiRespDto.builder() .statusCode(StatusCode.OK.getCode()) .message(StatusCode.OK.getMessage()) - .data(busRouteService.findByRouteId(routeId)) + .data(busRouteService.getRouteById(routeId)) .build() ); } diff --git a/server/src/main/java/com/talkka/server/bus/controller/BusRouteStationController.java b/server/src/main/java/com/talkka/server/bus/controller/BusRouteStationController.java index 68137781..0b868ee1 100644 --- a/server/src/main/java/com/talkka/server/bus/controller/BusRouteStationController.java +++ b/server/src/main/java/com/talkka/server/bus/controller/BusRouteStationController.java @@ -22,38 +22,38 @@ public class BusRouteStationController { private final BusRouteStationService routeStationService; - @GetMapping("/id/{id}") - public ResponseEntity>> findById( + @GetMapping("/{id}") + public ResponseEntity> getRouteStationById( @PathVariable("id") Long routeStationId) { return ResponseEntity.ok( - ApiRespDto.>builder() - .statusCode(StatusCode.OK.getCode()) - .message(StatusCode.OK.getMessage()) - .data(routeStationService.findByStationId(routeStationId)) - .build() - ); - } - - @GetMapping("/routeId/{routeId}") - public ResponseEntity>> findByRouteId( - @RequestParam("routeId") Long routeId) { - return ResponseEntity.ok( - ApiRespDto.>builder() + ApiRespDto.builder() .statusCode(StatusCode.OK.getCode()) .message(StatusCode.OK.getMessage()) - .data(routeStationService.findByRouteId(routeId)) + .data(routeStationService.getRouteStationById(routeStationId)) .build() ); } - @GetMapping("/stationId/{stationId}") - public ResponseEntity>> findByStationId( - @RequestParam("stationId") Long stationId) { + @GetMapping("") + public ResponseEntity>> getRouteStations( + @RequestParam(value = "routeId", required = false) Long routeId, + @RequestParam(value = "stationId", required = false) Long stationId) { + List routeStationList; + + if (routeId != null && stationId != null) { + routeStationList = routeStationService.getRouteStationsByRouteIdAndStationId(routeId, stationId); + } else if (routeId != null) { + routeStationList = routeStationService.getRouteStationsByRouteId(routeId); + } else if (stationId != null) { + routeStationList = routeStationService.getRouteStationsByStationId(stationId); + } else { + routeStationList = routeStationService.getRouteStations(); + } return ResponseEntity.ok( ApiRespDto.>builder() .statusCode(StatusCode.OK.getCode()) .message(StatusCode.OK.getMessage()) - .data(routeStationService.findByStationId(stationId)) + .data(routeStationList) .build() ); } diff --git a/server/src/main/java/com/talkka/server/bus/controller/BusStationController.java b/server/src/main/java/com/talkka/server/bus/controller/BusStationController.java index 925a62e4..6ddaeabf 100644 --- a/server/src/main/java/com/talkka/server/bus/controller/BusStationController.java +++ b/server/src/main/java/com/talkka/server/bus/controller/BusStationController.java @@ -4,6 +4,7 @@ import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; @@ -21,25 +22,32 @@ public class BusStationController { private final BusStationService stationService; - @GetMapping("/name/{name}") - public ResponseEntity>> findByStationName( - @RequestParam("name") String stationName) { + @GetMapping("") + public ResponseEntity>> getStations( + @RequestParam(value = "search", required = false) String stationName) { + List stationList; + + if (stationName != null) { + stationList = stationService.getStationsByStationName(stationName); + } else { + stationList = stationService.getStations(); + } return ResponseEntity.ok( ApiRespDto.>builder() .statusCode(StatusCode.OK.getCode()) .message(StatusCode.OK.getMessage()) - .data(stationService.findByStationName(stationName)) + .data(stationList) .build() ); } - @GetMapping("/id/{id}") - public ResponseEntity> findByStationId(@RequestParam("id") Long stationId) { + @GetMapping("/{id}") + public ResponseEntity> getStationById(@PathVariable("id") Long stationId) { return ResponseEntity.ok( ApiRespDto.builder() .statusCode(StatusCode.OK.getCode()) .message(StatusCode.OK.getMessage()) - .data(stationService.findByStationId(stationId)) + .data(stationService.getStationById(stationId)) .build() ); } diff --git a/server/src/main/java/com/talkka/server/bus/dao/BusRouteRepository.java b/server/src/main/java/com/talkka/server/bus/dao/BusRouteRepository.java index 64562d95..a9adc185 100644 --- a/server/src/main/java/com/talkka/server/bus/dao/BusRouteRepository.java +++ b/server/src/main/java/com/talkka/server/bus/dao/BusRouteRepository.java @@ -13,6 +13,6 @@ public interface BusRouteRepository extends JpaRepository Optional findByApiRouteId(String apiRouteId); - List findByRouteNameLikeOrderByRouteNameAsc(String routeName); + List findAllByRouteNameLikeOrderByRouteNameAsc(String routeName); } diff --git a/server/src/main/java/com/talkka/server/bus/dao/BusRouteStationRepository.java b/server/src/main/java/com/talkka/server/bus/dao/BusRouteStationRepository.java index ad1785b8..dd8bf57f 100644 --- a/server/src/main/java/com/talkka/server/bus/dao/BusRouteStationRepository.java +++ b/server/src/main/java/com/talkka/server/bus/dao/BusRouteStationRepository.java @@ -7,7 +7,9 @@ @Repository public interface BusRouteStationRepository extends JpaRepository { - List findByRouteId(Long routeId); + List findAllByRouteId(Long routeId); - List findByStationId(Long stationId); + List findAllByStationId(Long stationId); + + List findAllByRouteIdAndStationId(Long routeId, Long stationId); } diff --git a/server/src/main/java/com/talkka/server/bus/dto/BusRouteStationRespDto.java b/server/src/main/java/com/talkka/server/bus/dto/BusRouteStationRespDto.java index 78e0eef9..bff700ec 100644 --- a/server/src/main/java/com/talkka/server/bus/dto/BusRouteStationRespDto.java +++ b/server/src/main/java/com/talkka/server/bus/dto/BusRouteStationRespDto.java @@ -9,19 +9,21 @@ @Builder public record BusRouteStationRespDto( Long busRouteStationId, - BusRouteRespDto route, - BusStationRespDto station, Short stationSeq, String stationName, + Long routeId, + String routeName, + Long stationId, LocalDateTime createdAt ) { public static BusRouteStationRespDto of(BusRouteStationEntity busRouteStationEntity) { return new BusRouteStationRespDto( busRouteStationEntity.getId(), - BusRouteRespDto.of(busRouteStationEntity.getRoute()), - BusStationRespDto.of(busRouteStationEntity.getStation()), busRouteStationEntity.getStationSeq(), - busRouteStationEntity.getStationName(), + busRouteStationEntity.getStation().getStationName(), + busRouteStationEntity.getRoute().getId(), + busRouteStationEntity.getRoute().getRouteName(), + busRouteStationEntity.getStation().getId(), busRouteStationEntity.getCreatedAt() ); } diff --git a/server/src/main/java/com/talkka/server/bus/service/BusRouteService.java b/server/src/main/java/com/talkka/server/bus/service/BusRouteService.java index 662ba502..e2b05100 100644 --- a/server/src/main/java/com/talkka/server/bus/service/BusRouteService.java +++ b/server/src/main/java/com/talkka/server/bus/service/BusRouteService.java @@ -17,19 +17,25 @@ public class BusRouteService { private final BusRouteRepository busRouteRepository; - public BusRouteRespDto findByRouteId(Long routeId) { + public BusRouteRespDto getRouteById(Long routeId) { BusRouteEntity busRouteEntity = busRouteRepository.findById(routeId) .orElseThrow(() -> new BadRequestException("존재하지 않는 노선입니다.")); return BusRouteRespDto.of(busRouteEntity); } - public List findByRouteName(String routeName) { - return busRouteRepository.findByRouteNameLikeOrderByRouteNameAsc(routeName).stream() + public List getRoutes() { + return busRouteRepository.findAll().stream() .map(BusRouteRespDto::of) .toList(); } - public BusRouteRespDto createBusRoute(BusRouteCreateDto busRouteCreateDto) { + public List getRoutesByRouteName(String routeName) { + return busRouteRepository.findAllByRouteNameLikeOrderByRouteNameAsc(routeName).stream() + .map(BusRouteRespDto::of) + .toList(); + } + + public BusRouteRespDto createRoute(BusRouteCreateDto busRouteCreateDto) { if (!busRouteRepository.existsByApiRouteId(busRouteCreateDto.apiRouteId())) { throw new BadRequestException("이미 등록된 버스 노선입니다."); } diff --git a/server/src/main/java/com/talkka/server/bus/service/BusRouteStationService.java b/server/src/main/java/com/talkka/server/bus/service/BusRouteStationService.java index 4d2a72f8..17107fac 100644 --- a/server/src/main/java/com/talkka/server/bus/service/BusRouteStationService.java +++ b/server/src/main/java/com/talkka/server/bus/service/BusRouteStationService.java @@ -24,7 +24,7 @@ public class BusRouteStationService { private final BusStationRepository stationRepository; private final BusRouteStationRepository routeStationRepository; - public BusRouteStationRespDto createBusRouteStation(BusRouteStationCreateDto busRouteStationCreateDto) { + public BusRouteStationRespDto createRouteStation(BusRouteStationCreateDto busRouteStationCreateDto) { BusRouteEntity routeEntity = routeRepository.findByApiRouteId(busRouteStationCreateDto.apiRouteId()) .orElseThrow(() -> new BadRequestException("존재하지 않는 노선입니다.")); BusStationEntity stationEntity = stationRepository.findByApiStationId( @@ -34,20 +34,32 @@ public BusRouteStationRespDto createBusRouteStation(BusRouteStationCreateDto bus return BusRouteStationRespDto.of(routeStationRepository.save(busRouteStationEntity)); } - public BusRouteStationRespDto findById(Long id) { + public BusRouteStationRespDto getRouteStationById(Long id) { BusRouteStationEntity busRouteStationEntity = routeStationRepository.findById(id) .orElseThrow(() -> new BadRequestException("존재하지 않는 노선정류장입니다.")); return BusRouteStationRespDto.of(busRouteStationEntity); } - public List findByRouteId(Long routeId) { - return routeStationRepository.findByRouteId(routeId).stream() + public List getRouteStationsByRouteIdAndStationId(Long routeId, Long stationId) { + return routeStationRepository.findAllByRouteIdAndStationId(routeId, stationId).stream() .map(BusRouteStationRespDto::of) .toList(); } - public List findByStationId(Long stationId) { - return routeStationRepository.findByStationId(stationId).stream() + public List getRouteStationsByRouteId(Long routeId) { + return routeStationRepository.findAllByRouteId(routeId).stream() + .map(BusRouteStationRespDto::of) + .toList(); + } + + public List getRouteStationsByStationId(Long stationId) { + return routeStationRepository.findAllByStationId(stationId).stream() + .map(BusRouteStationRespDto::of) + .toList(); + } + + public List getRouteStations() { + return routeStationRepository.findAll().stream() .map(BusRouteStationRespDto::of) .toList(); } diff --git a/server/src/main/java/com/talkka/server/bus/service/BusStationService.java b/server/src/main/java/com/talkka/server/bus/service/BusStationService.java index 70cfdc26..3a2938b4 100644 --- a/server/src/main/java/com/talkka/server/bus/service/BusStationService.java +++ b/server/src/main/java/com/talkka/server/bus/service/BusStationService.java @@ -17,19 +17,25 @@ public class BusStationService { private final BusStationRepository busStationRepository; - public BusStationRespDto findByStationId(Long stationId) { + public BusStationRespDto getStationById(Long stationId) { BusStationEntity busStationEntity = busStationRepository.findById(stationId) .orElseThrow(() -> new BadRequestException("존재하지 않는 정거장입니다.")); return BusStationRespDto.of(busStationEntity); } - public List findByStationName(String stationName) { + public List getStationsByStationName(String stationName) { return busStationRepository.findByStationNameLikeOrderByStationNameAsc(stationName).stream() .map(BusStationRespDto::of) .toList(); } - public BusStationRespDto createBusStation(BusStationCreateDto busStationCreateDto) { + public List getStations() { + return busStationRepository.findAll().stream() + .map(BusStationRespDto::of) + .toList(); + } + + public BusStationRespDto createStation(BusStationCreateDto busStationCreateDto) { if (busStationRepository.existsByApiStationId(busStationCreateDto.apiStationId())) { throw new BadRequestException("이미 등록된 정거장입니다."); } diff --git a/server/src/main/java/com/talkka/server/review/controller/BusReviewController.java b/server/src/main/java/com/talkka/server/review/controller/BusReviewController.java index c6ec41ad..94c1cf5c 100644 --- a/server/src/main/java/com/talkka/server/review/controller/BusReviewController.java +++ b/server/src/main/java/com/talkka/server/review/controller/BusReviewController.java @@ -33,13 +33,18 @@ public class BusReviewController { @GetMapping("") public ResponseEntity>> getBusReviewList( - @AuthenticationPrincipal OAuth2UserInfo oAuth2UserInfo, - @RequestParam Long routeId, - @RequestParam Long busRouteStationId, - @RequestParam String timeSlot + @RequestParam(required = true) Long routeId, + @RequestParam(required = false) Long busRouteStationId, + @RequestParam(required = false) String timeSlot ) { - List reviewData = busReviewService.getBusReviewList(oAuth2UserInfo.getUserId(), routeId, - busRouteStationId, timeSlot); + List reviewData; + if (busRouteStationId != null && timeSlot != null) { + reviewData = busReviewService.getBusReviewList(routeId, busRouteStationId, timeSlot); + } else if (busRouteStationId != null) { + reviewData = busReviewService.getBusReviewList(routeId, busRouteStationId); + } else { + reviewData = busReviewService.getBusReviewList(routeId); + } return ResponseEntity.ok( ApiRespDto.>builder() diff --git a/server/src/main/java/com/talkka/server/review/dao/BusReviewRepository.java b/server/src/main/java/com/talkka/server/review/dao/BusReviewRepository.java index aa56ecd6..82754cce 100644 --- a/server/src/main/java/com/talkka/server/review/dao/BusReviewRepository.java +++ b/server/src/main/java/com/talkka/server/review/dao/BusReviewRepository.java @@ -9,9 +9,19 @@ @Repository public interface BusReviewRepository extends JpaRepository { - List findAllByWriterIdAndRouteIdAndStationIdAndTimeSlot( + + List findAllByWriterIdAndRouteIdAndStationIdAndTimeSlotOrderByUpdatedAtDesc( Long userId, Long routeId, Long busRouteStationId, TimeSlot timeSlot); + + List findAllByRouteIdOrderByCreatedAtDesc(Long routeId); + + List findAllByRouteIdAndStationIdOrderByCreatedAtDesc(Long routeId, Long stationId); + + List findAllByRouteIdAndStationIdAndTimeSlotOrderByCreatedAtDesc( + Long routeId, + Long stationId, + TimeSlot timeSlot); } diff --git a/server/src/main/java/com/talkka/server/review/dto/BusReviewRespDto.java b/server/src/main/java/com/talkka/server/review/dto/BusReviewRespDto.java index 9e68ae28..5c5af9c3 100644 --- a/server/src/main/java/com/talkka/server/review/dto/BusReviewRespDto.java +++ b/server/src/main/java/com/talkka/server/review/dto/BusReviewRespDto.java @@ -7,8 +7,11 @@ @Builder public record BusReviewRespDto( Long userId, + String userName, Long routeId, + String routeName, Long busRouteStationId, + String stationName, String content, String timeSlot, Integer rating @@ -16,8 +19,11 @@ public record BusReviewRespDto( public static BusReviewRespDto of(BusReviewEntity busEntity) { return new BusReviewRespDto( busEntity.getWriter().getId(), + busEntity.getWriter().getName(), busEntity.getRoute().getId(), + busEntity.getRoute().getRouteName(), busEntity.getStation().getId(), + busEntity.getStation().getStationName(), busEntity.getContent(), busEntity.getTimeSlot().getCode(), busEntity.getRating() diff --git a/server/src/main/java/com/talkka/server/review/service/BusReviewService.java b/server/src/main/java/com/talkka/server/review/service/BusReviewService.java index 84a80004..8ccfce3b 100644 --- a/server/src/main/java/com/talkka/server/review/service/BusReviewService.java +++ b/server/src/main/java/com/talkka/server/review/service/BusReviewService.java @@ -31,10 +31,11 @@ public class BusReviewService { private final BusRouteStationRepository busRouteStationRepository; private final BusRouteRepository busRouteRepository; - public List getBusReviewList( + public List getUsersBusReviewList( Long userId, Long routeId, Long busRouteStationId, String timeSlot ) { - List reviewList = busReviewRepository.findAllByWriterIdAndRouteIdAndStationIdAndTimeSlot( + // request param의 존재 유무에 따라 response가 변경되어야합니다. + List reviewList = busReviewRepository.findAllByWriterIdAndRouteIdAndStationIdAndTimeSlotOrderByUpdatedAtDesc( userId, routeId, busRouteStationId, EnumCodeConverterUtils.fromCode(TimeSlot.class, timeSlot)); return reviewList.stream() @@ -42,6 +43,30 @@ public List getBusReviewList( .toList(); } + public List getBusReviewList(Long routeId) { + List reviewEntityList = busReviewRepository.findAllByRouteIdOrderByCreatedAtDesc(routeId); + return reviewEntityList.stream() + .map(BusReviewRespDto::of) + .toList(); + } + + public List getBusReviewList(Long routeId, Long busRouteStationId) { + List reviewEntityList = busReviewRepository.findAllByRouteIdAndStationIdOrderByCreatedAtDesc( + routeId, busRouteStationId); + return reviewEntityList.stream() + .map(BusReviewRespDto::of) + .toList(); + } + + public List getBusReviewList(Long routeId, Long busRouteStationId, String timeSlot) { + List reviewEntityList = busReviewRepository.findAllByRouteIdAndStationIdAndTimeSlotOrderByCreatedAtDesc( + routeId, busRouteStationId, EnumCodeConverterUtils.fromCode(TimeSlot.class, timeSlot)); + return reviewEntityList.stream() + .map(BusReviewRespDto::of) + .toList(); + } + + @Transactional public BusReviewRespDto createBusReview(Long userId, BusReviewReqDto busReviewReqDto) { UserEntity user = userRepository.findById(userId) .orElseThrow(() -> new NotFoundException("존재하지 않는 유저입니다.")); @@ -77,6 +102,7 @@ public BusReviewRespDto updateBusReview(Long userId, Long busReviewId, BusReview return BusReviewRespDto.of(review); } + @Transactional public Long deleteBusReview(Long userId, Long busReviewId) { BusReviewEntity review = busReviewRepository.findById(busReviewId) .orElseThrow(() -> new NotFoundException("존재하지 않는 리뷰입니다.")); diff --git a/server/src/test/java/com/talkka/server/bus/BusTestFactory.java b/server/src/test/java/com/talkka/server/bus/BusTestFactory.java index dbbe3683..a285e9b9 100644 --- a/server/src/test/java/com/talkka/server/bus/BusTestFactory.java +++ b/server/src/test/java/com/talkka/server/bus/BusTestFactory.java @@ -159,10 +159,11 @@ public static BusRouteStationRespDto getBusRouteStationRespDto(Long id, BusRoute BusStationRespDto stationRespDto) { return BusRouteStationRespDto.builder() .busRouteStationId(id) - .route(routeRespDto) - .station(stationRespDto) - .stationName("정거장" + id) + .stationId(stationRespDto.stationId()) + .stationName("정거장" + stationRespDto.stationId()) .stationSeq(Short.valueOf(String.valueOf(id))) + .routeId(routeRespDto.routeId()) + .routeName(routeRespDto.routeName()) .build(); } diff --git a/server/src/test/java/com/talkka/server/bus/controller/BusRouteControllerTest.java b/server/src/test/java/com/talkka/server/bus/controller/BusRouteControllerTest.java index 3f902b63..fe3f59c9 100644 --- a/server/src/test/java/com/talkka/server/bus/controller/BusRouteControllerTest.java +++ b/server/src/test/java/com/talkka/server/bus/controller/BusRouteControllerTest.java @@ -43,11 +43,11 @@ public class FindByRouteIdTest { .data(getBusRouteRespDto(id)) .build() ); - given(routeService.findByRouteId(anyLong())).willReturn(getBusRouteRespDto(id)); + given(routeService.getRouteById(anyLong())).willReturn(getBusRouteRespDto(id)); // when - var result = routeController.findByRouteId(id); + var result = routeController.getRouteById(id); // then - verify(routeService, times(1)).findByRouteId(anyLong()); + verify(routeService, times(1)).getRouteById(anyLong()); Assertions.assertThat(result).isEqualTo(expected); } } @@ -74,7 +74,7 @@ public class FindByRouteNameTest { ) .build() ); - given(routeService.findByRouteName(anyString())).willReturn( + given(routeService.getRoutesByRouteName(anyString())).willReturn( List.of( getBusRouteRespDto(id1), getBusRouteRespDto(id2), @@ -82,9 +82,9 @@ public class FindByRouteNameTest { ) ); // when - var result = routeController.findByRouteName("7800"); + var result = routeController.getRoutes("7800"); // then - verify(routeService, times(1)).findByRouteName(anyString()); + verify(routeService, times(1)).getRoutesByRouteName(anyString()); Assertions.assertThat(result).isEqualTo(expected); } } diff --git a/server/src/test/java/com/talkka/server/bus/service/BusRouteServiceTest.java b/server/src/test/java/com/talkka/server/bus/service/BusRouteServiceTest.java index e1119aa1..7da099cc 100644 --- a/server/src/test/java/com/talkka/server/bus/service/BusRouteServiceTest.java +++ b/server/src/test/java/com/talkka/server/bus/service/BusRouteServiceTest.java @@ -31,8 +31,8 @@ public class BusRouteServiceTest { private BusRouteRepository busRouteRepository; @Nested - @DisplayName("createBusRoute method") - public class CreateBusRouteTest { + @DisplayName("createRoute method") + public class CreateRouteTest { @Test void 버스_노선을_생성한다() { // given @@ -42,7 +42,7 @@ public class CreateBusRouteTest { given(busRouteRepository.save(any(BusRouteEntity.class))).willReturn(busRouteEntity); given(busRouteRepository.existsByApiRouteId(any(String.class))).willReturn(true); // when - BusRouteRespDto result = busRouteService.createBusRoute(busRouteCreateDto); + BusRouteRespDto result = busRouteService.createRoute(busRouteCreateDto); // then assertThat(result).isEqualTo(busRouteRespDto); } @@ -55,15 +55,15 @@ public class CreateBusRouteTest { // when // then assertThatThrownBy( - () -> busRouteService.createBusRoute(reqDto) + () -> busRouteService.createRoute(reqDto) ).isInstanceOf(BadRequestException.class) .hasMessage("이미 등록된 버스 노선입니다."); } } @Nested - @DisplayName("findByRouteId method") - public class FindByRouteIdTest { + @DisplayName("getRouteByRouteId method") + public class GetRouteByIdTest { @Test void ID를_기반으로_버스_노선을_요청하면_레포지토리를_통해_결과를_DTO로_반환한다() { // given @@ -71,7 +71,7 @@ public class FindByRouteIdTest { BusRouteEntity foundEntity = getBusRouteEntity(routeId); given(busRouteRepository.findById(anyLong())).willReturn(Optional.of(foundEntity)); // when - var BusRouteRespDto = busRouteService.findByRouteId(routeId); + var BusRouteRespDto = busRouteService.getRouteById(routeId); // then verify(busRouteRepository).findById(anyLong()); assertThat(BusRouteRespDto).isEqualTo(getBusRouteRespDto(routeId)); @@ -85,7 +85,7 @@ public class FindByRouteIdTest { // when // then assertThatThrownBy( - () -> busRouteService.findByRouteId(1L) + () -> busRouteService.getRouteById(1L) ).isInstanceOf(exceptionClass) .hasMessage("존재하지 않는 노선입니다."); verify(busRouteRepository, times(1)).findById(anyLong()); @@ -93,8 +93,8 @@ public class FindByRouteIdTest { } @Nested - @DisplayName("findByRouteName method") - public class FindByRouteNameTest { + @DisplayName("getRoutesByRouteName method") + public class GetRoutesByRouteNameTest { @Test void 버스노선이름을_요청으로_받아_repository에서_조회하고_해당_이름으로_시작하는_노선들을_리스트로_반환한다() { @@ -103,15 +103,33 @@ public class FindByRouteNameTest { String routeName = "7800"; var entityList = List.of(getBusRouteEntity(1L), getBusRouteEntity(2L)); var expectedList = List.of(getBusRouteRespDto(1L), getBusRouteRespDto(2L)); - given(busRouteRepository.findByRouteNameLikeOrderByRouteNameAsc(any(String.class))).willReturn(entityList); + given(busRouteRepository.findAllByRouteNameLikeOrderByRouteNameAsc(any(String.class))).willReturn( + entityList); // when - var resultList = busRouteService.findByRouteName(routeName); + var resultList = busRouteService.getRoutesByRouteName(routeName); // then - verify(busRouteRepository, times(1)).findByRouteNameLikeOrderByRouteNameAsc(anyString()); + verify(busRouteRepository, times(1)).findAllByRouteNameLikeOrderByRouteNameAsc(anyString()); assertThat(resultList).containsAll(expectedList); } } + + @Nested + @DisplayName("getRoutes method") + public class GetRoutesTest { + @Test + void 모든_버스_노선을_조회한다() { + // given + var entityList = List.of(getBusRouteEntity(1L), getBusRouteEntity(2L)); + var expectedList = List.of(getBusRouteRespDto(1L), getBusRouteRespDto(2L)); + given(busRouteRepository.findAll()).willReturn(entityList); + // when + var resultList = busRouteService.getRoutes(); + // then + verify(busRouteRepository, times(1)).findAll(); + assertThat(resultList).containsAll(expectedList); + } + } } diff --git a/server/src/test/java/com/talkka/server/bus/service/BusRouteStationServiceTest.java b/server/src/test/java/com/talkka/server/bus/service/BusRouteStationServiceTest.java index a6b8bbf9..02ea1450 100644 --- a/server/src/test/java/com/talkka/server/bus/service/BusRouteStationServiceTest.java +++ b/server/src/test/java/com/talkka/server/bus/service/BusRouteStationServiceTest.java @@ -36,8 +36,8 @@ public class BusRouteStationServiceTest { private BusRouteStationRepository routeStationRepository; @Nested - @DisplayName("createBusStation method") - public class CreateBusStationTest { + @DisplayName("createStation method") + public class CreateStationTest { @Test void BusRouteStationReqDto를_요청으로_받아_BusRouteStationRepository에_저장한다() { /// given @@ -50,7 +50,7 @@ public class CreateBusStationTest { given(routeStationRepository.save(any(BusRouteStationEntity.class))).willReturn( getBusRouteStationEntity(id, getBusRouteEntity(id), getBusStationEntity(id))); // when - var result = routeStationService.createBusRouteStation(createDto); + var result = routeStationService.createRouteStation(createDto); // then assertThat(result).isEqualTo(expected); } @@ -62,7 +62,7 @@ public class CreateBusStationTest { given(routeRepository.findByApiRouteId(any())).willReturn(Optional.empty()); // when // then - assertThatThrownBy(() -> routeStationService.createBusRouteStation(createDto)).isInstanceOf( + assertThatThrownBy(() -> routeStationService.createRouteStation(createDto)).isInstanceOf( BadRequestException.class).hasMessage("존재하지 않는 노선입니다."); } @@ -74,98 +74,112 @@ public class CreateBusStationTest { given(stationRepository.findByApiStationId(any())).willReturn(Optional.empty()); // when // then - assertThatThrownBy(() -> routeStationService.createBusRouteStation(createDto)).isInstanceOf( + assertThatThrownBy(() -> routeStationService.createRouteStation(createDto)).isInstanceOf( BadRequestException.class).hasMessage("존재하지 않는 정류장입니다."); } } @Nested - @DisplayName("findById method") - public class FindByIdTest { - + @DisplayName("getRouteStationsByRouteIdAndStationId method") + public class GetRouteStationsByRouteIdAndStationIdTest { @Test - void Id를_받아_해당되는_정류장노선_정보를_조회하고_결과를_RespDto로_반환한다() { + void RouteId와_StationId를_받아_해당_아이디의_노선정류장을_조회한다() { // given - Long id = 1L; - var expected = getBusRouteStationRespDto(id, getBusRouteRespDto(id), getBusStationRespDto(id)); - given(routeStationRepository.findById(any(Long.class))).willReturn( - Optional.of(getBusRouteStationEntity(id, getBusRouteEntity(id), getBusStationEntity(id)))); + Long routeId = 1L; + Long stationId = 1L; + var expected = List.of(getBusRouteStationRespDto(1L, getBusRouteRespDto(1L), getBusStationRespDto(1L))); + given(routeStationRepository.findAllByRouteIdAndStationId(anyLong(), anyLong())).willReturn( + List.of(getBusRouteStationEntity(1L, getBusRouteEntity(1L), getBusStationEntity(1L)))); // when - var result = routeStationService.findById(id); + var result = routeStationService.getRouteStationsByRouteIdAndStationId(routeId, stationId); // then assertThat(result).isEqualTo(expected); + verify(routeStationRepository, times(1)).findAllByRouteIdAndStationId(anyLong(), anyLong()); } + } + @Nested + @DisplayName("getRouteStationsByRouteId method") + public class GetRouteStationsByRouteIdTest { @Test - void 존재하지_않는_Id면_Exception을_throw한다() { + void RouteId를_받아_해당_아이디의_노선정류장을_조회한다() { // given - Long id = 1L; - given(routeStationRepository.findById(anyLong())).willReturn(Optional.empty()); + Long routeId = 1L; + var expected = List.of(getBusRouteStationRespDto(1L, getBusRouteRespDto(1L), getBusStationRespDto(1L))); + given(routeStationRepository.findAllByRouteId(anyLong())).willReturn( + List.of(getBusRouteStationEntity(1L, getBusRouteEntity(1L), getBusStationEntity(1L)))); // when - + var result = routeStationService.getRouteStationsByRouteId(routeId); // then - assertThatThrownBy(() -> routeStationService.findById(id)).isInstanceOf(BadRequestException.class) - .hasMessage("존재하지 않는 노선정류장입니다."); + assertThat(result).isEqualTo(expected); + verify(routeStationRepository, times(1)).findAllByRouteId(anyLong()); } } @Nested - @DisplayName("findByRouteId method") - public class FindByRouteIdTest { - + @DisplayName("getRouteStationsByStationId method") + public class GetRouteStationsByStationIdTest { @Test - void RouteId를_받아_해당노선에_속하는_정류장정보를_조회하고_결과를_RespDto의_리스트로_반환한다() { + void StationId를_받아_해당_아이디의_노선정류장을_조회한다() { // given - Long routeId = 1L; - Long id1 = 2L; - Long id2 = 3L; - Long id3 = 4L; - var expected = List.of( - getBusRouteStationRespDto(id1, getBusRouteRespDto(routeId), getBusStationRespDto(id1)), - getBusRouteStationRespDto(id2, getBusRouteRespDto(routeId), getBusStationRespDto(id2)), - getBusRouteStationRespDto(id3, getBusRouteRespDto(routeId), getBusStationRespDto(id3)) - ); - given(routeStationRepository.findByRouteId(any(Long.class))).willReturn( - List.of( - getBusRouteStationEntity(id1, getBusRouteEntity(routeId), getBusStationEntity(id1)), - getBusRouteStationEntity(id2, getBusRouteEntity(routeId), getBusStationEntity(id2)), - getBusRouteStationEntity(id3, getBusRouteEntity(routeId), getBusStationEntity(id3)) - ) - ); + Long stationId = 1L; + var expected = List.of(getBusRouteStationRespDto(1L, getBusRouteRespDto(1L), getBusStationRespDto(1L))); + given(routeStationRepository.findAllByStationId(anyLong())).willReturn( + List.of(getBusRouteStationEntity(1L, getBusRouteEntity(1L), getBusStationEntity(1L)))); // when - var result = routeStationService.findByRouteId(routeId); + var result = routeStationService.getRouteStationsByStationId(stationId); // then assertThat(result).isEqualTo(expected); + verify(routeStationRepository, times(1)).findAllByStationId(anyLong()); } } @Nested - @DisplayName("findByStationId method") - public class FindByStationIdTest { + @DisplayName("getRouteStations method") + public class GetRouteStationsTest { + @Test + void 모든_노선정류장을_조회한다() { + // given + var expected = List.of(getBusRouteStationRespDto(1L, getBusRouteRespDto(1L), getBusStationRespDto(1L))); + given(routeStationRepository.findAll()).willReturn( + List.of(getBusRouteStationEntity(1L, getBusRouteEntity(1L), getBusStationEntity(1L)))); + // when + var result = routeStationService.getRouteStations(); + // then + assertThat(result).isEqualTo(expected); + verify(routeStationRepository, times(1)).findAll(); + } + } + @Nested + @DisplayName("getRouteStationById method") + public class GetRouteStationByIdTest { @Test - void StationId를_받아_해당노선에_속하는_정류장정보를_조회하고_결과를_RespDto의_리스트로_반환한다() { + void ID를_받아_해당_아이디의_노선정류장을_조회한다() { // given - Long stationId = 1L; - Long id1 = 2L; - Long id2 = 3L; - Long id3 = 4L; - var expected = List.of( - getBusRouteStationRespDto(id1, getBusRouteRespDto(id1), getBusStationRespDto(stationId)), - getBusRouteStationRespDto(id2, getBusRouteRespDto(id2), getBusStationRespDto(stationId)), - getBusRouteStationRespDto(id3, getBusRouteRespDto(id3), getBusStationRespDto(stationId)) - ); - given(routeStationRepository.findByStationId(any(Long.class))).willReturn( - List.of( - getBusRouteStationEntity(id1, getBusRouteEntity(id1), getBusStationEntity(stationId)), - getBusRouteStationEntity(id2, getBusRouteEntity(id2), getBusStationEntity(stationId)), - getBusRouteStationEntity(id3, getBusRouteEntity(id3), getBusStationEntity(stationId)) - ) - ); + Long id = 1L; + var expected = getBusRouteStationRespDto(id, getBusRouteRespDto(id), getBusStationRespDto(id)); + given(routeStationRepository.findById(anyLong())).willReturn( + Optional.of(getBusRouteStationEntity(id, getBusRouteEntity(id), getBusStationEntity(id)))); // when - var result = routeStationService.findByStationId(stationId); + var result = routeStationService.getRouteStationById(id); // then assertThat(result).isEqualTo(expected); + verify(routeStationRepository, times(1)).findById(anyLong()); + } + + @Test + void ID가_존재하지_않으면_Exception을_throw한다() { + // given + Class exceptionClass = BadRequestException.class; + given(routeStationRepository.findById(anyLong())).willReturn(Optional.empty()); + // when + // then + assertThatThrownBy( + () -> routeStationService.getRouteStationById(1L) + ).isInstanceOf(exceptionClass) + .hasMessage("존재하지 않는 노선정류장입니다."); + verify(routeStationRepository, times(1)).findById(anyLong()); } } } diff --git a/server/src/test/java/com/talkka/server/bus/service/BusStationServiceTest.java b/server/src/test/java/com/talkka/server/bus/service/BusStationServiceTest.java index 1088d79f..b6191cfb 100644 --- a/server/src/test/java/com/talkka/server/bus/service/BusStationServiceTest.java +++ b/server/src/test/java/com/talkka/server/bus/service/BusStationServiceTest.java @@ -30,8 +30,8 @@ class BusStationServiceTest { private BusStationRepository busStationRepository; @Nested - @DisplayName("findByStationId method") - public class FindByStationId { + @DisplayName("getStationByStationId method") + public class GetStationByStationId { @Test void ID를_기반으로_버스_정류장을_요청하면_레포지토리를_통해_조회하여_결과를_DTO로_반환한다() { Long stationId = 1L; @@ -39,7 +39,7 @@ public class FindByStationId { BusStationRespDto expected = getBusStationRespDto(stationId); given(busStationRepository.findById(stationId)).willReturn(Optional.of(busStationEntity)); // when - BusStationRespDto result = busStationService.findByStationId(stationId); + BusStationRespDto result = busStationService.getStationById(stationId); // then verify(busStationRepository, times(1)).findById(anyLong()); assertThat(result).isEqualTo(expected); @@ -54,7 +54,7 @@ public class FindByStationId { // when // then assertThatThrownBy( - () -> busStationService.findByStationId(stationId) + () -> busStationService.getStationById(stationId) ).isInstanceOf(exceptionCLass) .hasMessage("존재하지 않는 정거장입니다."); verify(busStationRepository, times(1)).findById(anyLong()); @@ -70,7 +70,7 @@ public class CreateBusStationTest { BusStationCreateDto createDto = getBusStationCreateDto(1L); given(busStationRepository.save(any(BusStationEntity.class))).willReturn(getBusStationEntity(1L)); // when - var result = busStationService.createBusStation(createDto); + var result = busStationService.createStation(createDto); // then verify(busStationRepository, times(1)).save(any(BusStationEntity.class)); assertThat(result).isEqualTo(getBusStationRespDto(1L)); @@ -84,14 +84,14 @@ public class CreateBusStationTest { given(busStationRepository.existsByApiStationId(createDto.apiStationId())).willReturn(true); // when // then - assertThatThrownBy(() -> busStationService.createBusStation(createDto)) + assertThatThrownBy(() -> busStationService.createStation(createDto)) .isInstanceOf(exceptionClass).hasMessage("이미 등록된 정거장입니다."); } } @Nested - @DisplayName("findByStationName method") - public class FindByStationNameTest { + @DisplayName("getStationsByStationName method") + public class GetStationsByStationNameTest { @Test void 정류장_이름으로_요청하면_해당_이름으로_시작하는_정류장의_리스트를_반환한다() { // given @@ -106,10 +106,33 @@ public class FindByStationNameTest { ); given(busStationRepository.findByStationNameLikeOrderByStationNameAsc(anyString())).willReturn(entityList); // when - var result = busStationService.findByStationName(stationName); + var result = busStationService.getStationsByStationName(stationName); // then assertThat(result).containsAll(expected); verify(busStationRepository, times(1)).findByStationNameLikeOrderByStationNameAsc(anyString()); } } + + @Nested + @DisplayName("getStations method") + public class GetStationsTest { + @Test + void 모든_정류장을_조회한다() { + // given + List expected = List.of( + getBusStationRespDto(1L), + getBusStationRespDto(12L) + ); + List entityList = List.of( + getBusStationEntity(1L), + getBusStationEntity(12L) + ); + given(busStationRepository.findAll()).willReturn(entityList); + // when + var result = busStationService.getStations(); + // then + assertThat(result).containsAll(expected); + verify(busStationRepository, times(1)).findAll(); + } + } } \ No newline at end of file diff --git a/server/src/test/java/com/talkka/server/review/service/BusReviewServiceTest.java b/server/src/test/java/com/talkka/server/review/service/BusReviewServiceTest.java index ce66357f..36a21fb2 100644 --- a/server/src/test/java/com/talkka/server/review/service/BusReviewServiceTest.java +++ b/server/src/test/java/com/talkka/server/review/service/BusReviewServiceTest.java @@ -3,6 +3,8 @@ import static org.assertj.core.api.Assertions.*; import static org.mockito.BDDMockito.*; +import java.time.LocalDateTime; +import java.util.List; import java.util.Optional; import org.junit.jupiter.api.DisplayName; @@ -49,8 +51,11 @@ public class BusReviewServiceTest { private BusReviewRespDto busReviewRespDtoFixture(Long userId) { return BusReviewRespDto.builder() .userId(userId) + .userName("유저 이름") .routeId(236000050L) + .routeName("노선 이름") .busRouteStationId(1L) + .stationName("정류장 이름") .content("리뷰 내용") .timeSlot(TimeSlot.T_00_00.getCode()) .rating(4) @@ -60,27 +65,165 @@ private BusReviewRespDto busReviewRespDtoFixture(Long userId) { private UserEntity getUserFixture(Long userId) { return UserEntity.builder() .id(userId) + .name("유저 이름") .build(); } private BusRouteStationEntity getBusRouteStationFixture(Long busRouteStationId) { return BusRouteStationEntity.builder() .id(busRouteStationId) + .stationName("정류장 이름") .build(); } private BusRouteEntity getBusRouteFixture(Long routeId) { return BusRouteEntity.builder() .id(routeId) + .routeName("노선 이름") .build(); } + private List getReviewEntity(Long routeId, Long busRouteStationId, TimeSlot timeSlot) { + if (busRouteStationId == null) { + return List.of( + BusReviewEntity.builder() + .id(1L) + .content("리뷰 내용") + .timeSlot(TimeSlot.T_00_00) + .rating(4) + .writer(getUserFixture(1L)) + .station(getBusRouteStationFixture(1L)) + .route(getBusRouteFixture(routeId)) + .createdAt(LocalDateTime.now().plusMinutes(1)) + .updatedAt(LocalDateTime.now()) + .build(), + BusReviewEntity.builder() + .id(2L) + .content("리뷰 내용") + .timeSlot(TimeSlot.T_00_00) + .rating(5) + .writer(getUserFixture(1L)) + .station(getBusRouteStationFixture(1L)) + .route(getBusRouteFixture(routeId)) + .createdAt(LocalDateTime.now()) + .updatedAt(LocalDateTime.now()) + .build() + ); + } else if (timeSlot == null) { + return List.of( + BusReviewEntity.builder() + .id(1L) + .content("리뷰 내용") + .timeSlot(TimeSlot.T_00_00) + .rating(4) + .writer(getUserFixture(1L)) + .station(getBusRouteStationFixture(busRouteStationId)) + .route(getBusRouteFixture(routeId)) + .createdAt(LocalDateTime.now().plusMinutes(1)) + .updatedAt(LocalDateTime.now()) + .build(), + BusReviewEntity.builder() + .id(2L) + .content("리뷰 내용") + .timeSlot(TimeSlot.T_00_00) + .rating(5) + .writer(getUserFixture(1L)) + .station(getBusRouteStationFixture(busRouteStationId)) + .route(getBusRouteFixture(routeId)) + .createdAt(LocalDateTime.now().plusMinutes(1)) + .updatedAt(LocalDateTime.now()) + .build() + ); + } else { + return List.of( + BusReviewEntity.builder() + .id(1L) + .content("리뷰 내용") + .timeSlot(timeSlot) + .rating(4) + .writer(getUserFixture(1L)) + .station(getBusRouteStationFixture(busRouteStationId)) + .route(getBusRouteFixture(routeId)) + .createdAt(LocalDateTime.now()) + .updatedAt(LocalDateTime.now()) + .build(), + BusReviewEntity.builder() + .id(2L) + .content("리뷰 내용") + .timeSlot(timeSlot) + .rating(5) + .writer(getUserFixture(1L)) + .station(getBusRouteStationFixture(busRouteStationId)) + .route(getBusRouteFixture(routeId)) + .createdAt(LocalDateTime.now()) + .updatedAt(LocalDateTime.now()) + .build() + ); + } + } + + @Nested + @DisplayName("getBusReviewList 메서드 테스트") + public class GetBusReviewListTest { + @Test + void 버스_노선_아이디_대한_리뷰를_조회한다() { + // given + Long routeId = 236000050L; + List reviewEntityList = getReviewEntity(routeId, null, null); + var expected = reviewEntityList.stream().map(BusReviewRespDto::of).toList(); + + given(busReviewRepository.findAllByRouteIdOrderByCreatedAtDesc(anyLong())).willReturn(reviewEntityList); + // when + var result = busReviewService.getBusReviewList(routeId); + // then + verify(busReviewRepository, times(1)).findAllByRouteIdOrderByCreatedAtDesc(routeId); + assertThat(result).isEqualTo(expected); + } + + @Test + void 버스_노선_아이디와_정거장에_대한_리뷰를_조회한다() { + // given + Long routeId = 236000050L; + Long busRouteStationId = 1L; + + List reviewEntityList = getReviewEntity(routeId, busRouteStationId, null); + var expected = reviewEntityList.stream().map(BusReviewRespDto::of).toList(); + given(busReviewRepository.findAllByRouteIdAndStationIdOrderByCreatedAtDesc(anyLong(), anyLong())) + .willReturn(reviewEntityList); + // when + var result = busReviewService.getBusReviewList(routeId, busRouteStationId); + // then + verify(busReviewRepository, times(1)).findAllByRouteIdAndStationIdOrderByCreatedAtDesc(routeId, + busRouteStationId); + assertThat(result).isEqualTo(expected); + } + + @Test + void 버스_노선_아이디와_정거장_그리고_타임슬롯에_대한_리뷰를_조회한다() { + // given + Long routeId = 236000050L; + Long busRouteStationId = 1L; + TimeSlot timeSlot = EnumCodeConverterUtils.fromCode(TimeSlot.class, TimeSlot.T_00_00.getCode()); + + List reviewEntityList = getReviewEntity(routeId, busRouteStationId, timeSlot); + var expected = reviewEntityList.stream().map(BusReviewRespDto::of).toList(); + given(busReviewRepository.findAllByRouteIdAndStationIdAndTimeSlotOrderByCreatedAtDesc(anyLong(), anyLong(), + any(TimeSlot.class))).willReturn(reviewEntityList); + // when + var result = busReviewService.getBusReviewList(routeId, busRouteStationId, TimeSlot.T_00_00.getCode()); + // then + verify(busReviewRepository, times(1)).findAllByRouteIdAndStationIdAndTimeSlotOrderByCreatedAtDesc(routeId, + busRouteStationId, timeSlot); + assertThat(result).isEqualTo(expected); + } + } + @Nested @DisplayName("createBusReview 메서드 테스트") public class CreateBusReviewTest { @Test - void 제한된_요청에_따라_버스리뷰를_생성한다() { + void 제안된_요청에_따라_버스리뷰를_생성한다() { //given UserEntity user = getUserFixture(1L); BusRouteStationEntity station = getBusRouteStationFixture(1L);