-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
1단계 - 학습 테스트 실습 #4116
1단계 - 학습 테스트 실습 #4116
Conversation
1단계 - 학습 테스트 실습
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.
1단계 구현하느라 수고했네요. 💯
바로 merge하기 아쉬워 소소한 피드백 남겨봤어요.
assert 문은 junit이 아닌 assertj 라이브러리 사용하면 훨씬 더 풍부한 api를 사용할 수 있어요.
다음 단계 진행할 때 함께 반영해 보세요.
1단계는 리뷰 사이클을 경험하는 과정이라 제가 대신 merge해요.
@Test | ||
@DisplayName("size()를 통해 Set의 크기를 확인할 수 있다.") | ||
void size() { | ||
assertEquals(3, numbers.size()); |
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.
assertEquals(3, numbers.size()); | |
assertThat(numbers).hasSize(3); |
@ValueSource(ints = {1, 2, 3}) | ||
@DisplayName("contains()를 통해 Set에 값이 존재하는지 확인할 수 있다.") | ||
void contains_01(int value) { | ||
assertTrue(numbers.contains(value)); |
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.
assertTrue(numbers.contains(value)); | |
assertThat(numbers).contains(1, 2, 3); |
//given | ||
String word = "1,2"; | ||
|
||
//when | ||
String[] result = word.split(","); |
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.
//given | |
String word = "1,2"; | |
//when | |
String[] result = word.split(","); | |
final String[] actual = "1,2".split(","); |
로컬 변수 없이 구현해도 되지 않을까?
//given | ||
String word = "1"; | ||
|
||
//when | ||
String[] result = word.split(","); | ||
|
||
//then | ||
assertThat(result).containsExactly("1"); | ||
assertEquals(1, result.length); |
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.
굳이 given/when/then을 써야 할까?
오히려 가독성을 떨어트리는 것은 아닐까?
빈 공백 라인을 통해 구분하는 것도 좋은 방법이지 않을까?
안녕하세요 멘토님!@ 잘부탁드립니다😀