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

Step2: 문자열 계산기 PR #761

Merged
merged 16 commits into from May 14, 2020
Merged

Conversation

JunilHwang
Copy link

문자열 계산기 PR 리뷰 부탁드립니다!

Copy link

@serverwizard serverwizard left a comment

Choose a reason for hiding this comment

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

요구사항에 맞게 문자열 계산기 구현하느라 고생하셨습니다. 👍
코멘트 남겨두었으니 확인 부탁드립니다~

미션 진행 중 질문이 있으시면 메세지, 혹은 코멘트를 남겨주세요!

src/main/java/step2/CalculatorError.java Show resolved Hide resolved
src/main/java/step2/Operation.java Show resolved Hide resolved
src/main/java/step2/StringCalculator.java Show resolved Hide resolved
src/main/java/step2/StringCalculator.java Outdated Show resolved Hide resolved
src/main/java/step2/StringCalculator.java Outdated Show resolved Hide resolved
src/main/java/step2/StringCalculator.java Outdated Show resolved Hide resolved
src/main/java/step2/StringCalculator.java Outdated Show resolved Hide resolved
src/test/java/step2/StringCalculatorTest.java Show resolved Hide resolved
src/main/java/step2/StringCalculator.java Outdated Show resolved Hide resolved
src/main/java/step2/StringCalculator.java Outdated Show resolved Hide resolved
Copy link

@serverwizard serverwizard left a comment

Choose a reason for hiding this comment

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

피드백 반영 하시느라 고생하셨습니다. 👍
간단한 코멘트 남겼으니, 다음 step 진행하실 때 참고 부탁드립니다.

미션 진행 중 질문이 있으시면 메세지, 혹은 코멘트를 남겨주세요!

src/main/java/step2/StringCalculator.java Show resolved Hide resolved
return this.result;
}

public void calculate () {

Choose a reason for hiding this comment

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

calculate메소드를 static으로 바꾸고, 생성자에 있는 유효성 검사 로직을 calculate 메소드로 옮긴다면
생성자가 필요 없을 것 같아요~ 이렇게 함으로써 인스턴스 변수(expression)도 제거할 수 있을거구요.
또한 calculate 메소드가 최종 연산 결과까지 리턴을 해준다면 남은 인스턴스 변수(result)도 제거할 수 있겠네요~

Copy link
Author

Choose a reason for hiding this comment

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

흠 그럼 calulate 메소드에 너무 많은 기능이 들어가는건 아닐까요?

src/main/java/step2/StringCalculator.java Show resolved Hide resolved
src/main/java/step2/StringCalculator.java Show resolved Hide resolved
@ValueSource(strings = { "", "null", " " })
void NULL_혹은_공백_테스트 (String expression) {
assertThatIllegalArgumentException()
.isThrownBy(() -> calculator.scanExpression(expression.equals("null") ? null : expression));

Choose a reason for hiding this comment

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

삼항 연산자를 사용하지 않고, 입력 값이 null인 경우와 공백인 경우의 테스트를 나누는 건 어떨까요?
또한 아래 링크를 통해 @NullAndEmptySource 애노테이션을 학습해보는 것도 좋을 것 같아요.
https://www.baeldung.com/parameterized-tests-junit-5

src/test/java/step2/StringCalculatorTest.java Show resolved Hide resolved
@serverwizard serverwizard merged commit 265e9d1 into next-step:junilhwang May 14, 2020
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