Skip to content

Conversation

@Ogu1208
Copy link
Contributor

@Ogu1208 Ogu1208 commented Aug 6, 2025

관련 Issue (필수)

주요 변경 사항 (필수)

테스트

  • TrainSearchApplicationServiceTest: Application Service 통합 테스트
  • TrainSearchServiceSeatStatusTest: 좌석 상태 로직 검증
  • TrainSearchServiceOverlapReservationTest: 다구간 예약 겹침 로직 검증
  • TrainSearchServiceTest: 기본 검색 기능 테스트
  • TrainSearchValidationTest: DTO 입력 검증 테스트

추가로, 좌석 상태 및 기존 예약의 구간 겹침 판단 검증을 위해 아래 Helper 클래스에 로직을 추가했습니다.

  • ReservationTestHelper
    • 복수의 seatIds로 출발, 도착역을 직접 지정하여 SeatReservation을 생성하는 시나리오 생성 메서드 추가
    • 지정한 인원 수만큼 입석 예약을 생성하는 메서드 추가
  • TrainTestHelper: 현실적인 열차 구성(2+2, 2+1 좌석 배열로 직접 객차 개수, 행 개수 지정) 생성 메서드 추가

기능 변경

  • TrainCarListResponsetrainScheduleId 필드 추가 : 연관 데이터 추적
  • 입석 처리 로직 변경 : 단순 매진 여부만 체크 -> 입석석 수용 가능 여부까지 체크
  • 좌석 상태 판단 로직 변경 : 고정 수치 기반(+20석일 때 여유) -> 비율 기반(25% 이상 잔여 있을 시 여유)

리뷰어 참고 사항

image image

추가 정보

없음

PR 작성 체크리스트 (필수)

  • 제목이 Issue와 동일함을 확인했습니다.
  • 리뷰어를 지정했습니다.
  • 프로젝트를 연결했습니다.

Copy link
Contributor

@chanwonlee chanwonlee left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

열차 조회 서비스 테스트 코드 확인했습니다. 해당 부분이 검색 조건도 복잡하고 다양한 케이스가 있어서 테스트 작성하기 어려웠을 텐데 꼼꼼히 테스트 코드 작성해서 커버리지를 거의 100% 근접하게 달성한게 대단하신것 같습니다! 고생하셨습니다!

Copy link
Contributor

@Yunsung-Jo Yunsung-Jo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

고생하셨습니다! 👍

Copy link
Contributor

@Friox Friox left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

열차 부분에서도 고려해야 할 케이스가 정말 많았을 텐데, 거의 100%에 가까운 커버리지를 달성하신 것이 정말 대단하다고 생각합니다!
고생하셨습니다! 👍👍

Copy link
Contributor

@Jimin730 Jimin730 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

기능 변경된 부분과 테스트 코드 확인했습니다!
테스트 코드 내에 record 타입을 따로 만들어서 여러가지 시나리오를 한 번에 테스트 할 수 있군요...
저도 다음에 참고해서 적용해보고싶네요!!
고생하셨습니다 👍 👍

@Ogu1208 Ogu1208 force-pushed the test/201-train-search-service branch from ffc9782 to 5f92551 Compare August 7, 2025 02:29
Copy link
Contributor

@EndlessMilkyway EndlessMilkyway left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

테스트 코드 뿐만 아니라 비즈니스 영역에도 대대적인 수정이 이루어졌군요!

민아님께서 테스트 코드를 작성하신 부분이 이 프로젝트에서 가장 복잡한 부분이라고 생각됩니다...!

고생하셨습니다👍

@Ogu1208 Ogu1208 merged commit d64f4a2 into develop Aug 7, 2025
3 checks passed
@Ogu1208 Ogu1208 deleted the test/201-train-search-service branch August 7, 2025 02:36
@github-project-automation github-project-automation bot moved this from In Review to Done in 🚅 코레일 Aug 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

[TEST] 열차 조회 서비스 테스트(TrainSearchApplicationService, TrainSearchService)

7 participants