Repository navigation
Conversation
kangdaeho99
reviewed
Jul 9, 2024
There was a problem hiding this comment.
[사소한 질문] Spring Frameowkr의 의존성을 사용하는 이유가 궁금해요~~!
질문하는 이유는 Java의 Plguins만으로도 작업할 수 있다고 생각했습니다!
Contributor
Author
There was a problem hiding this comment.
이거 사실,,, junit5 라이브러리 추가하기 귀찮아서요 ㅋㅋㅋㅋㅋ
매번 스프링부트 프로젝트 만들어서 쓰다보니까 그냥 환경만들기 쉽게 했습니다.
kangdaeho99
reviewed
Jul 9, 2024
|
|
||
| public class Splitter { | ||
|
|
||
| private static final List<String> DEFAULT_DELIMITERS = List.of(",", ":"); |
There was a problem hiding this comment.
[칭찬] 기본구분자에 다른 구분자가 추가되었을떄 빠르게 추가할 수 있을 것 같네요!
또, 리스트 생성시에 Arrays.asList(",",":") 방식도 있을텐데, List.of(",", ":"); 가 불변객체로 생성되어 안전하게 사용한것이 좋은 것 같아요!
kangdaeho99
reviewed
Jul 9, 2024
| public class SplitterTest { | ||
|
|
||
| @ParameterizedTest | ||
| @ValueSource(strings = {"1,2", "1:2"}) |
There was a problem hiding this comment.
[칭찬] JUnit5의 여러 애노테이션 사용으로 테스트가 편해지는게 좋습니다!
kangdaeho99
reviewed
Jul 9, 2024
| private final Splitter splitter; | ||
| private static final int ZERO = 0; | ||
|
|
||
| public StringCalculator(Splitter splitter) { |
kangdaeho99
reviewed
Jul 9, 2024
| @Test | ||
| void 음수는_더할수없다() { | ||
| StringCalculator stringCalculator = new StringCalculator(new Splitter()); | ||
| assertThatThrownBy(() -> stringCalculator.add("1,-1")) |
There was a problem hiding this comment.
[칭찬] RuntimeException 발생 여부도 assertJ에서도 확인할 수 있군요!
kangdaeho99
reviewed
Jul 9, 2024
|
|
||
| import org.springframework.boot.autoconfigure.SpringBootApplication; | ||
|
|
||
| public enum RegexSplitPattern { |
There was a problem hiding this comment.
[칭찬] enum(열거형) 방식 사용해서 다른 커스텀 정규패턴이 추가되면, 쉽게 추가할 수 있겠네요!!
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
문자열 계산기 기능목록
클래스 역할
StringCalculator
RegexSplitPattern
Splitter