-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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단계] - 학습 테스트 실습 #5877
[1단계] - 학습 테스트 실습 #5877
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.
안녕하세요, 준형님
리뷰어 성준혁입니다. 😊
코멘트 남겼어요! 함께 잘해봐요!
// given | ||
int expected = 3; | ||
|
||
// when | ||
int sut = numbers.size(); | ||
|
||
// then | ||
assertThat(sut).isEqualTo(expected); |
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 | |
int expected = 3; | |
// when | |
int sut = numbers.size(); | |
// then | |
assertThat(sut).isEqualTo(expected); | |
assertThat(numbers).hasSize(3); |
이렇게도 사용해 보면 어떨까요?
@ParameterizedTest | ||
@ValueSource(ints = {1, 2, 3}) | ||
void containsTest(int argument) { | ||
assertThat(numbers.contains(argument)).isTrue(); |
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.
assertThat(numbers.contains(argument)).isTrue(); | |
assertThat(numbers).contains(argument); |
String[] sut = str.split(","); | ||
|
||
// then | ||
assertAll(() -> assertThat(sut).contains("1", "2"), () -> assertThat(sut).containsExactly("1", "2")); |
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.
containsExactly
검증만으로 contains
를 포함하고 있으니 contains
검증은 제거해도 좋습니다.
assertAll(() -> assertThat(sut).contains("1", "2"), () -> assertThat(sut).containsExactly("1", "2")); | |
assertThat(sut).containsExactly("1", "2"); |
|
||
public class StringTest { | ||
|
||
@DisplayName("1,2를 ','로 split 했을 때 1과 2로 잘 분리되는지 확인한다.") |
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.
테스트 케이스 마다 설명이 잘 작성되어 있네요 👍
이번 미션 잘 부탁 드립니다 ~