-
Notifications
You must be signed in to change notification settings - Fork 2
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
[FEAT] 주제, 선택지 조회 기능 구현 #36
Conversation
리뷰 중점 사항
|
application-local.yml spring:
h2:
console:
enabled: true
path: /h2-console
datasource:
driver-class-name: org.h2.Driver
url: jdbc:h2:mem:db;MODE=MYSQL
username: sa
password:
jpa:
generate-ddl: 'true'
hibernate:
ddl-auto: create
properties:
hibernate:
show_sql: true
format_sql: true
highlight_sql: true
use_sql_comments: true
database-platform: org.hibernate.dialect.H2Dialect
logging:
level:
org:
hibernate:
orm:
jdbc:
bind: TRACE
springframework:
transaction:
interceptor: TRACE
|
backend/src/test/java/ddangkong/controller/BaseControllerTest.java
Outdated
Show resolved
Hide resolved
TODO List
|
init-test.sql에서 데이터 입력 시 한 번에 입력하도록 수정
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.
빠른 반영 👍🏼
어제 논의했던 클래스명, 필드명 수정도 반영해주시면 감사하겠습니다!
이에 따라 dto 필드명도 몇 가지 수정이 생길 것 같아요 함께 확인 부탁드려요
approve 하겠습니당
- BalanceQuestion -> BalanceContent로 변경 - 필드명 content, title 등을 name으로 바꿈
변경 사항
기타 사항
|
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.
항상 열심히 하는 커찬 칭찬해~
backend/src/main/java/ddangkong/domain/content/RoomContentRepository.java
Outdated
Show resolved
Hide resolved
backend/src/main/java/ddangkong/controller/content/dto/BalanceContentResponse.java
Outdated
Show resolved
Hide resolved
backend/src/main/java/ddangkong/controller/exception/GlobalExceptionHandler.java
Show resolved
Hide resolved
backend/src/main/java/ddangkong/controller/option/dto/BalanceOptionResponse.java
Outdated
Show resolved
Hide resolved
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.
커찬 고생하셨숩니다! 질문이나 의견 남겨두었는데 확인 부탁드려요!
backend/src/main/java/ddangkong/controller/content/dto/BalanceContentResponse.java
Outdated
Show resolved
Hide resolved
@ExceptionHandler | ||
public ErrorResponse handleBindingException(BindException e) { |
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.
의견) 여기 ResponseStatus가 안되어 있는 것 같네요! 확인 부탁드려요!
@@ -0,0 +1,27 @@ | |||
package ddangkong.controller.content.dto; |
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.
의견) BalanceOption, BalanceContent 라는 도메인 네이밍이지만 패키지는 그냥 content 인 것이 괜찮을 지 고민이 되네요
저희가 밸런스 게임 제공 서비스가 아니라 대화주제 제공 서비스이며, 밸런스 게임은 그 중 하나의 도메인일 뿐이니 이런식으로 두는 건 어떨까에 대해 같이 고민해보면 좋을 것 같아요!
depth가 깊어지지만 알아보기는 더 쉬울 것 같기도 합니다:)
controller/
│ ├── balance/
│ │ ├── option/
│ │ │ └── BalanceOptionController.java
│ │ └── question/
│ │ └── BalanceQuestionController.java
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.
7/22 회의 결과, balance package 추가하도록 하겠습니다~
backend/src/main/java/ddangkong/controller/content/dto/BalanceContentResponse.java
Outdated
Show resolved
Hide resolved
private static final BalanceContentResponse EXPECTED_RESPONSE = new BalanceContentResponse( | ||
1L, Category.EXAMPLE, "민초 vs 반민초", | ||
new BalanceOptionResponse(1L, "민초"), | ||
new BalanceOptionResponse(2L, "반민초")); |
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.
의견) 특정 기능에서 필요한 클래스 변수는 Nested Class 내부에 넣어두는 것이 어떨까요?
new BalanceOptionResponse(2L, "반민초")); | ||
|
||
@Nested | ||
class 방의_질문_조회 { |
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.
사소한 의견) 기능에 대한 설명을 명확히 하기위해 방의_현재_질문_조회
로 변경하는 것은 어떨까요?
void 방의_가장_최신의_질문을_조회할_수_있다() { | ||
RoomContent actual = roomContentRepository.findTopByRoomIdOrderByCreatedAtDesc(1L).get(); | ||
|
||
assertThat(actual.getId()).isEqualTo(2L); | ||
} |
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.
사소한 의견) Service 로직에 given, when, then 을 사용해서 테스트에 대한 이해도를 높여주면 어떨까 싶습니다~!
테스트 코드는 기능에 대한 문서라고 생각하기 잘 정의해두면 좋을 것 같아서 때문에 제안드려봤어요!
@Test | ||
void 현재_방의_질문을_조회할_수_있다() { | ||
BalanceContentResponse actual = RestAssured.given().log().all() | ||
.when().get("/api/balances/rooms/1/question") | ||
.then().log().all() | ||
.statusCode(200) | ||
.extract().as(BalanceContentResponse.class); | ||
|
||
assertThat(actual).isEqualTo(EXPECTED_RESPONSE); | ||
} | ||
} |
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.
컨트롤러 레이어에서는 해피케이스, Request와 관련된 내용만 테스트하고 나머지 예외 상황은 서비스 레이어에서 테스트 했습니다.
현 상황에서 컨트롤러는 서비스가 예외를 일으키는지 알 수 없으니까, 예외와 관련된 테스트는 서비스 레이어만으로 충분하다고 생각합니다. 만약 예외 상황에 대한 테스트가 필요하다고 생각된다면, GlobalExceptionHandlerTest
를 만들도록 하겠습니다~
TODO
|
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.
LGTM 🤗🤗
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.
LGTM🔥
네이밍관련 사소한 의견 한 가지 남겨두었으니 확인부탁드려요!
private BalanceContentService balanceContentService; | ||
|
||
@Nested | ||
class 현재_방의_내용_조회 { |
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.
사소한 의견) 방의 내용이라기 보단, 현재_방의_밸런스_게임_내용_조회
가 BalanceContent라는 도메인에 적합한 테스트 클래스명이지 않을까 싶습니다:)
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.
커칭커칭~
테스트가 어떤 도메인인지 드러나도록 변경
2cc2472
Issue Number
#28
As-Is
방에 진행 중인(가장 최신의) 주제, 선택지 조회 기능 필요
To-Be
방에 진행 중인(가장 최신의) 주제, 선택지 조회 기능 구현
Check List
Test Screenshot
(Optional) Additional Description