-
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] 다음 라운드 넘어가기 API #75
Merged
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
4922e3f
feat: 다음 라운드로 넘어가는 도메인 로직 구현 #63
leegwichan eeabec4
feat: 다음 라운드로 이동하는 비즈니스 로직 구현 #63
leegwichan 6138897
feat: 다음 라운드로 넘어가는 API 구현 #63
leegwichan 074de80
test: 테스트 코드 일부 Map의 정적 팩토리 메서드 사용, 개행 제거
leegwichan f05d550
fix: 질문 조회 API 경로 수정 #63
leegwichan 55963de
refactor: 역할이 없는 ResponseEntity 제거 #63
leegwichan 9c2fdcb
refactor: 이미 조회한 객체를 다시 조회하지 않도록 리팩터링 #63
leegwichan 7132cbc
merge: develop의 변경 사항과 충돌 해결
leegwichan File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
50 changes: 50 additions & 0 deletions
50
backend/src/test/java/ddangkong/domain/balance/room/RoomTest.java
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
package ddangkong.domain.balance.room; | ||
|
||
import static org.assertj.core.api.Assertions.assertThat; | ||
import static org.assertj.core.api.Assertions.assertThatThrownBy; | ||
|
||
import ddangkong.exception.BadRequestException; | ||
import org.junit.jupiter.api.Nested; | ||
import org.junit.jupiter.api.Test; | ||
|
||
class RoomTest { | ||
|
||
@Nested | ||
class 다음_라운드로_이동 { | ||
|
||
private static final int START_ROUND = 1; | ||
private static final int TOTAL_ROUND = 5; | ||
|
||
@Test | ||
void 다음_라운드로_이동할_수_있다() { | ||
// given | ||
Room room = new Room(); | ||
int currentRound = room.getCurrentRound(); | ||
int expectedRound = currentRound + 1; | ||
|
||
// when | ||
room.moveToNextRound(); | ||
|
||
// then | ||
assertThat(room.getCurrentRound()).isEqualTo(expectedRound); | ||
} | ||
|
||
@Test | ||
void 마지막_라운드_일_경우_예외를_던진다() { | ||
// given | ||
Room room = new Room(); | ||
goToFinalRound(room); | ||
|
||
// when & then | ||
assertThatThrownBy(() -> room.moveToNextRound()) | ||
.isInstanceOf(BadRequestException.class) | ||
.hasMessage("마지막 라운드입니다."); | ||
} | ||
|
||
private void goToFinalRound(Room room) { | ||
for (int round = START_ROUND; round < TOTAL_ROUND; round++) { | ||
room.moveToNextRound(); | ||
} | ||
} | ||
} | ||
} |
Oops, something went wrong.
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.
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.
의견) 이후에 Room의 total_round를 생성자를 통해 입력하게 되면 이 테스트는 터지게될 수도 있으니 주의가 필요할 것 같네요.
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.
아마도 지금 사용하는 생성자를 유지하지 않을까 싶어요. 결국에는 초기 방 생성시에는 TOTAL_ROUND의 기본 값이 필요할 테니까요. 그리고
updateTotalRound()
형식으로 바뀌어지지 않을까요?미래를 생각하는 힘드니, 지금 이 형식은 유지하고, 나중에 값이 바뀔 수 있을 때 조금 다듬어야 겠네요;;