[4기 신재윤] Weekely Mission 1,3 PR 제출합니다 #273
[4기 신재윤] Weekely Mission 1,3 PR 제출합니다 #273Shin-Jae-Yoon wants to merge 9 commits intoprgrms-be-devcourse:Shin-Jae-Yoonfrom
Conversation
.gitignore
Outdated
| *.hprof | ||
|
|
||
| # log file | ||
| logs/ No newline at end of file |
build.gradle
Outdated
| } | ||
|
|
||
| dependencies { | ||
| implementation 'org.springframework.boot:spring-boot-starter-data-jpa' |
There was a problem hiding this comment.
알아보기 쉽게 주석으로 표시해주시면 고마울 것 같아요!
| return new Name(firstName, lastName); | ||
| } | ||
|
|
||
| private void checkNameLength(String firstName, String lastName) { |
There was a problem hiding this comment.
-
Pattern 객체 내부를 봤을 때 new Pattern()이라는 점과 정규표현식의 생성비용이 크다고 알고 있어서 반드시 필요한 부분에서만 사용하는 것이 좋다고 판단했습니다 !
-
현재는 문자 내용에 대한 검증보단 길이에 대한 검증만 하고 있어서 pattern까지는 필요하지 않겠구나 생각했습니다 !!
| @Column(name = "item_id") | ||
| private Long itemId; | ||
|
|
||
| private int price; |
| @Column(name = "order_status", nullable = false) | ||
| private OrderStatus orderStatus; | ||
|
|
||
| @Lob |
There was a problem hiding this comment.
(답변) @lob 애노테이션은 DB의 varchar(255) 이상인 경우, 즉, 문자열의 길이가 길어지는 경우 사용할 수 있는 형식입니다 ! 메모의 경우 길이가 길어질 수 있다고 생각하여 다음과 같이 지정했씀니다 :)
src/main/resources/application.yml
Outdated
|
|
||
| h2: | ||
| console: | ||
| enabled: true No newline at end of file |
| assertThat(all).hasSize(1) | ||
| .contains(customer2); | ||
| } | ||
| } No newline at end of file |
|
|
||
| @Embeddable | ||
| @Getter | ||
| @NoArgsConstructor |
There was a problem hiding this comment.
해당 부분의 접근 제어을 설정안하신 이유가 있을까요?
There was a problem hiding this comment.
@NoArgsConstructor(access = AccessLevel.PROTECTED)와 생성자에 대한 부분을 수정하였습니다.
명확하게 알려주셔서 감사합니다 :)
|
재윤님 과제하느라 고생하셨습니다~ |
kmebin
left a comment
There was a problem hiding this comment.
리뷰할 게 크게 없었던 것 같아요! 재윤님 과제 고생하셨습니다~
| // then | ||
| assertThat(customer.getName()).isEqualTo(name); |
There was a problem hiding this comment.
DB에 제대로 업데이트가 되었는지 검증하려면, 해당 customer id로 조회한 값으로 검증하는 것이 맞지 않을까요?!
| // given | ||
| Customer customer = new Customer("재윤", "신"); | ||
| repository.save(customer); | ||
| Name name2 = new Name(); |
There was a problem hiding this comment.
수상한 놈 처리했습니다. 감사합니다
| INVALID_FIRST_NAME_REQUEST("유효하지 않은 이름 길이입니다.\n"), | ||
| INVALID_LAST_NAME_REQUEST("유효하지 않은 성 길이입니다.\n"); |
There was a problem hiding this comment.
클라이언트한테 응답할 때도 사용할 걸 고려하면 줄바꿈은 없는 게 좋을 것 같습니다!
|
|
||
| @Getter | ||
| @RequiredArgsConstructor | ||
| public enum ErrorMessage { |
There was a problem hiding this comment.
enm에서 @RequiredArgsConstructor를 사용하신 이유가 따로 있으신가요??
There was a problem hiding this comment.
enum 내의 필드들은 final 필드라서 그에 대한 생성자가 필요한데, 그에 맞게 필요한 것만 추가하도록 @requiredargsconstructor를 사용하여 코드를 줄이고 가독성을 높였습니다 !
| @DisplayName("고객 등록 실패 - 이름 길이") | ||
| @ParameterizedTest | ||
| @CsvSource({ | ||
| ", 신", "1234567891011121314151617181920, 신" |
There was a problem hiding this comment.
이부분은 null에 해당하는 것으로, 현재 이름 길이가 짧은 경우 실패하는 것에 대한 테스트입니다 :)
ymkim97
left a comment
There was a problem hiding this comment.
재윤님 과제 하시느라 고생많았습니다!
저두 다른 분들과 겹쳐서 그나마 한부분에 대해서 의견을 남깁니다...!
| @Test | ||
| void contextLoads() { | ||
| } | ||
|
|
There was a problem hiding this comment.
쓰지않는 테스트는 지우는게 좋을 것 같습니다!
상위 test/java 폴더를 우클릭하고 Run All Tests를 하면 그사이에 섞여서 보이게 됩니다!
There was a problem hiding this comment.
수상한 놈 제거했습니다. 감사합니다
📌 과제 설명
👩💻 요구 사항과 구현 내용
Mission 1
Mission 2
Mission 3