-
Notifications
You must be signed in to change notification settings - Fork 746
2단계 - 사다리(생성) #2402
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
base: chanseong95
Are you sure you want to change the base?
2단계 - 사다리(생성) #2402
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
안녕하세요! 미션 진행하느라 고생하셨어요~ 👍🏻
전반적으로 잘 작성해주셨는데요. 프로그래밍 요구사항을 준수하지 않은 부분들이 있어 우선 Request Chages 해요~ 좋은 하루 보내세요! 👋🏻
while (iterator.hasNext()) { | ||
boolean cur = iterator.next(); | ||
if (prev && cur) { | ||
throw new IllegalArgumentException("Ladder lines cannot be connected continuously."); | ||
} | ||
prev = cur; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- indent 2를 허용하지 않는 등 기존 미션의 프로그래밍 요구사항도 준수하셔야 해요~
@Override | ||
public String toString() { | ||
final StringBuilder sb = new StringBuilder(); | ||
for (Boolean line : lines) { | ||
sb.append("|"); | ||
sb.append(line ? "--------": " "); | ||
} | ||
sb.append("|"); | ||
return sb.toString(); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- Presentation Layer와의 결합이 발생할 우려가 있네요. 위와 같이 작성하는게 현재 수준에서는 합리적이긴 하다는 생각이 들기는 하는데요. View Model과의 결합을 한번 분리해보시죠~
public static List<String> getPersonNameInput(String prompt, String delimiter) { | ||
System.out.println(prompt); | ||
while (true) { | ||
String line = scanner.nextLine(); | ||
|
||
String[] split = line.split(delimiter); | ||
if (split.length == 0) { | ||
System.out.println("이름은 하나 이상 입력되어야 합니다. 다시 입력해 주세요."); | ||
continue; | ||
} | ||
|
||
List<String> result = Arrays.stream(split) | ||
.map(String::trim) | ||
.filter(s -> !s.isEmpty()) | ||
.collect(Collectors.toList()); | ||
|
||
if (split.length != result.size()) { | ||
System.out.println("이름은 중복될 수 없습니다. 다시 입력해 주세요."); | ||
continue; | ||
} | ||
|
||
if (result.stream().allMatch(s -> s.length() <= PersonName.MAX_NAME_LENGTH)) { | ||
return result; | ||
} | ||
|
||
System.out.println("이름은 최대 5글자까지 사용 가능합니다. 다시 입력해 주세요."); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- 15라인에 대한 규칙도 있었지요..?
리뷰 부탁드려요!
LadderLineGenerator 클래스에서 랜덤으로 사다리 라인 생성하는 건 테스트 코드를 작성하지 않았는데, 단순히 mocking 테스트를 작성하는 건 LadderLine 테스트 코드와 겹친다고 생각해서 의미가 없다고 생각했습니다.