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

Step3 #1853

Open
wants to merge 21 commits into
base: hoyeoon
Choose a base branch
from
Open

Step3 #1853

Changes from 1 commit
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
97f2c06
docs: 3단계 - 사다리(게임 실행) 기능 요구사항 작성
hoyeoon May 28, 2023
7e1b66c
test: 실행결과 생성, 글자수 예외 테스트
hoyeoon May 28, 2023
0796fcd
feat: 실행 결과 입력 추가
hoyeoon May 28, 2023
7db91d9
feat: 사다리 출력시 실행 결과 포함
hoyeoon May 28, 2023
56f35bb
test: 특정인의 결과 확인
hoyeoon May 28, 2023
c9688d4
refactor: 클래스 분리
hoyeoon May 29, 2023
fb04575
refactor: 인스턴스 변수명 수정
hoyeoon May 29, 2023
17e3d2e
feat: 사다리 2차원 배열 만들기
hoyeoon May 29, 2023
02d71a8
fix: 실행결과 출력 수정
hoyeoon May 29, 2023
d2c1b02
refactor: 테스트 수정, 클래스명 수정
hoyeoon May 29, 2023
5ce386b
refactor: 사다리 출력 방식 수정
hoyeoon May 29, 2023
85628d9
refactor: 공백 출력 방식 수정
hoyeoon May 29, 2023
9cfc315
feat: 시작인덱스를 넣었을 때 도착인덱스를 반환하는 메서드 구현
hoyeoon May 29, 2023
c457816
refactor: 메서드 분리
hoyeoon May 29, 2023
4fd74e1
test: 사다리 결과
hoyeoon May 29, 2023
35046c7
feat: 사다리 결과
hoyeoon May 29, 2023
1103791
feat: 입력받은 사람에 대한 결과 출력
hoyeoon May 29, 2023
b91f2b2
feat: 입력 받은 사람 이름이 참여할 사람 이름 목록에 없을 경우 예외처리
hoyeoon May 29, 2023
74beb37
test: 입력 받은 사람 이름이 참여할 사람 이름 목록에 없을 경우 예외처리
hoyeoon May 29, 2023
42f3c43
refactor: 테스트 수정
hoyeoon May 29, 2023
5aea879
refactor: 테스트 수정
hoyeoon May 29, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
test: 실행결과 생성, 글자수 예외 테스트
hoyeoon committed May 28, 2023
commit 7e1b66c9bbcb7ecb539b77a5d5e00b77f60332de
25 changes: 25 additions & 0 deletions src/main/java/nextstep/ladder/domain/ExecuteResult.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
package nextstep.ladder.domain;

public class ExecuteResult {
private static final int NAME_LENGTH_MAX = 5;

private final String name;

public ExecuteResult(String name) {
if (name.length() > NAME_LENGTH_MAX) {
throw new IllegalArgumentException("글자수는 최대 5글자까지 부여할 수 있습니다.");
}
this.name = name;
}

public String name() {
return this.name;
}

@Override
public String toString() {
return "ExecuteResult{" +
"name='" + name + '\'' +
'}';
}
}
22 changes: 22 additions & 0 deletions src/test/java/nextstep/ladder/domain/ExecuteResultTest.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package nextstep.ladder.domain;

import org.junit.jupiter.api.Test;

import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException;
import static org.assertj.core.api.AssertionsForClassTypes.assertThat;

public class ExecuteResultTest {

@Test
void create() {
ExecuteResult result = new ExecuteResult("꽝");
assertThat(result.name()).isEqualTo(new ExecuteResult("꽝").name());
}

@Test
void 글자수_5이상시_예외() {
assertThatIllegalArgumentException()
.isThrownBy(() -> new ExecuteResult("500000"))
.withMessageContaining("글자수는 최대 5글자까지 부여할 수 있습니다.");
}
}