Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

3단계 - 자동차 경주 #6062

Open
wants to merge 27 commits into
base: idisdi
Choose a base branch
from
Open

3단계 - 자동차 경주 #6062

wants to merge 27 commits into from

Conversation

idisdi
Copy link

@idisdi idisdi commented Mar 20, 2025

안녕하세요, 멘토님!

PR이 늦어졌습니다. 테스트 코드가 허술한 부분이 있지만 2회차 강의 전까지 최소 3단계는 제출하는 것을 목표로 우선 제출 드립니다.

질문 🙋🏻‍♀️

  • 어떤 메소드가 테스트 코드가 필요할까요? 만약 추려야 한다면 멘토님께서는 어떤 메소드들 위주로 테스트 코드를 작성하시는 지 궁금합니다.

감사합니다!

jlee0505 and others added 27 commits March 10, 2025 21:37
- EOF 표시
- 경계값 추가로 테스트 보완
- jdk 문제로 jdk 타 벤더사로 재설치. 관련 설정 제거.
- 문제: findCustomerSeparator 메소드를 테스트하는 과정에서, 기존 클래스 내 private static 값이었던 separators 를 테스트하기 어려운 문제
- 접근: 클래스 내 priavte 공용값이었던 separators를 로컬변수로 취급하는 순수함수를 만들어 반환하는 로직으로 변경
- 변경된 로직에 따라 추가된 테스트 수정 및 수행
- 모든 메소드를 합쳐 실행하는 최종 메소드 테스트
- invalid input 역할에 따라 세분화
- 변경 이유:
 테스트 코드를 짜며 System.in의 고정되면 테스트하기가 어렵다는 것을 배웠습니다. 현재 코드는 입력 소스가 고정되어 있어, 테스트할 때 입력 값을 모킹(Mock)하거나 가짜 데이터를 주입하기 기 위해 필요한 ByteArrayInputStream 같은 대체 입력 스트림을 사용할 수 없습니다. 따라서 Scanner를 생성 시 주입 받도록 코드를 수정하였습니다.
- Random 값을 클래스 외부에서 주입할 수 있도록 수정
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants