-
Notifications
You must be signed in to change notification settings - Fork 122
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
전남대BE_박진화_1주차 과제(step3) #202
base: main
Are you sure you want to change the base?
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.
안녕하세요 진화님!
세 개의 PR 에 걸쳐서 리뷰 남겨봤어요.
한 번 스윽 보고 반영할 부분이 있다면 반영해보죠!
그리고 질문 남긴건 댓글로 답변을 남겨주시면 제가 확인해보도록 할게요.
주말 잘 보내시고, 같이 파이팅해보죠!! 🔥 🔥 🔥
@Test | ||
void getAllProducts() throws Exception { | ||
when(productService.getAllProducts()).thenReturn(Collections.singletonList(product)); | ||
|
||
mockMvc.perform(get("/products")) | ||
.andExpect(status().isOk()) | ||
.andExpect(content().contentType(MediaType.TEXT_HTML)) | ||
.andExpect(view().name("products")) | ||
.andExpect(model().attributeExists("products")) | ||
.andExpect(model().attribute("products", Collections.singletonList(product))); | ||
} |
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.
현재 테스트가 실패하고 있어요!
PR 을 올리기 전에 프로젝트 컴파일이 잘 되는지,
그리고 테스트가 다 통과되는지 한 번 확인해보고 올리면 좋을 것 같아요 :)
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.
넵!
spring.datasource.driverClassName=org.h2.Driver | ||
spring.datasource.username=sa | ||
spring.datasource.password= | ||
spring.datasource.initialization-mode=always |
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.
해당 옵션은 deprecated 되고, 새로운 방식이 나왔는데 한 번 적용해보면 어떨까요?
왜 deprecated 되었는지도 한 번 알아보면 좋을 것 같아요 :)
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.
구글링하던 코드 중에 좀 옛날 코드가 있던 것 같습니다. 한 번 찾아보도록할게요!
spring.datasource.url=jdbc:h2:mem:testdb | ||
spring.datasource.driverClassName=org.h2.Driver | ||
spring.datasource.username=sa | ||
spring.datasource.password= | ||
spring.datasource.initialization-mode=always | ||
|
||
# SQL scripts locations | ||
spring.sql.init.mode=always | ||
spring.sql.init.schema-locations=classpath:schema.sql | ||
spring.sql.init.data-locations=classpath:data.sql | ||
|
||
# H2 Console settings | ||
spring.h2.console.enabled=true | ||
spring.h2.console.path=/h2-console |
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.
끝에 ^M
표시는 없앨 수 없을까요? 🤔
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.
이게 어쩌다가 들어갔는지 저도 잘 기억이 안나네요..! 없애볼게요!
@BeforeEach | ||
void setUp() { | ||
// 데이터 초기화 코드가 필요할 경우 추가 | ||
} |
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.
이전에 남겼던 리뷰를 토대로 생각해보자면
- 불필요한 주석
- 사용하지 않는 코드
이 두가지 모두 해당하는 부분인 것 같아요!
과감하게 지워주도록 하죠 :)
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.
넵 알겠습니다!
@Test | ||
void getAllProducts() { |
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.
@DisplayName
을 활용하여 테스트에 이름을 지어보는건 어떨까요?
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.
생각치 못한 부분인데 감사합니다! 테스트에 이름을 붙여보겠습니다.
시간이 없어서 빠르게 완료했습니다. 잘못된 부분이 있을 수도 있어서 해당 부분 양해 부탁드립니다.