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

1단계 - 학습 테스트 실습 #4116

Merged
merged 8 commits into from Apr 4, 2023
Merged

1단계 - 학습 테스트 실습 #4116

merged 8 commits into from Apr 4, 2023

Conversation

dkswnkk
Copy link

@dkswnkk dkswnkk commented Apr 3, 2023

안녕하세요 멘토님!@ 잘부탁드립니다😀

  • String Class Test
  • Set Collection Test

Copy link
Contributor

@javajigi javajigi left a 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());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
assertTrue(numbers.contains(value));
assertThat(numbers).contains(1, 2, 3);

Comment on lines +14 to +18
//given
String word = "1,2";

//when
String[] result = word.split(",");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
//given
String word = "1,2";
//when
String[] result = word.split(",");
final String[] actual = "1,2".split(",");

로컬 변수 없이 구현해도 되지 않을까?

Comment on lines +27 to +35
//given
String word = "1";

//when
String[] result = word.split(",");

//then
assertThat(result).containsExactly("1");
assertEquals(1, result.length);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

굳이 given/when/then을 써야 할까?
오히려 가독성을 떨어트리는 것은 아닐까?
빈 공백 라인을 통해 구분하는 것도 좋은 방법이지 않을까?

@javajigi javajigi merged commit 08be183 into next-step:dkswnkk Apr 4, 2023
@dkswnkk dkswnkk deleted the dkswnkk branch April 4, 2023 15:30
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.

None yet

2 participants