Skip to content

Commit

Permalink
fix: 게임 진행 시간을 10, 15, 30, 60초로 변경
Browse files Browse the repository at this point in the history
  • Loading branch information
leegwichan committed Oct 15, 2024
1 parent a710439 commit 30a53ed
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public class RoomSetting {
private static final int DEFAULT_TOTAL_ROUND = 5;
private static final int MIN_TOTAL_ROUND = 3;
private static final int MAX_TOTAL_ROUND = 10;
private static final List<Integer> ALLOWED_TIME_LIMIT = List.of(5_000, 10_000, 15_000, 30_000);
private static final List<Integer> ALLOWED_TIME_LIMIT = List.of(10_000, 15_000, 30_000, 60_000);
private static final int DEFAULT_TIME_LIMIT_MSEC = 10_000;

@Column(nullable = false)
Expand Down
22 changes: 11 additions & 11 deletions backend/src/test/java/ddangkong/domain/room/RoomSettingTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

class RoomSettingTest {

private static final List<Integer> ALLOWED_TIME_LIMIT = List.of(5_000, 10_000, 15_000, 30_000);
private static final List<Integer> ALLOWED_TIME_LIMIT = List.of(10_000, 15_000, 30_000, 60_000);

@Nested
class_설정 {
Expand All @@ -23,30 +23,30 @@ class 방_설정 {
@ValueSource(ints = {3, 10})
void 라운드는_3이상_10이하_여야한다(int validTotalRound) {
// when & then
assertThatCode(() -> new RoomSetting(validTotalRound, 5000, Category.IF))
assertThatCode(() -> new RoomSetting(validTotalRound, 15_000, Category.IF))
.doesNotThrowAnyException();
}

@ParameterizedTest
@ValueSource(ints = {2, 11})
void 라운드는_3미만_10초과인_경우_예외를_던진다(int notValidTotalRound) {
// when & then
assertThatThrownBy(() -> new RoomSetting(notValidTotalRound, 5000, Category.IF))
assertThatThrownBy(() -> new RoomSetting(notValidTotalRound, 15_000, Category.IF))
.isExactlyInstanceOf(InvalidRangeTotalRoundException.class)
.hasMessage("총 라운드는 %d 이상, %d 이하만 가능합니다. requested totalRound: %d"
.formatted(3, 10, notValidTotalRound));
}

@ParameterizedTest
@ValueSource(ints = {5_000, 10_000, 15_000, 30_000})
@ValueSource(ints = {10_000, 15_000, 30_000, 60_000})
void 시간_제한은_허용된_시간__하나_여야한다(int validateTimeLimit) {
// when & then
assertThatCode(() -> new RoomSetting(5, validateTimeLimit, Category.IF))
.doesNotThrowAnyException();
}

@ParameterizedTest
@ValueSource(ints = {4_999, 10_001, 15_001, 30_001})
@ValueSource(ints = {10_001, 15_001, 30_001, 59_999})
void 시간_제한은_특정_시간이_아니라면_예외를_던진다(int notValidTimeLimit) {
// when & then
assertThatThrownBy(() -> new RoomSetting(5, notValidTimeLimit, Category.IF))
Expand All @@ -63,7 +63,7 @@ class 방_라운드_변경 {
@ValueSource(ints = {3, 10})
void 라운드는_3이상_10이하_여야한다(int totalRound) {
// given
RoomSetting setting = new RoomSetting(5, 5_000, Category.IF);
RoomSetting setting = new RoomSetting(5, 15_000, Category.IF);

// when
setting.updateTotalRound(totalRound);
Expand All @@ -76,7 +76,7 @@ class 방_라운드_변경 {
@ValueSource(ints = {2, 11})
void 라운드는_3미만_10초과인_경우_예외를_던진다(int notValidTotalRound) {
// given
RoomSetting setting = new RoomSetting(5, 5_000, Category.IF);
RoomSetting setting = new RoomSetting(5, 15_000, Category.IF);

// when & then
assertThatThrownBy(() -> setting.updateTotalRound(notValidTotalRound))
Expand All @@ -89,10 +89,10 @@ class 방_라운드_변경 {
@Nested
class 제한_시간_설정 {
@ParameterizedTest
@ValueSource(ints = {5_000, 10_000, 15_000, 30_000})
@ValueSource(ints = {10_000, 15_000, 30_000, 60_000})
void 시간_제한은_허용된_시간__하나_여야한다(int timeLimit) {
// given
RoomSetting setting = new RoomSetting(5, 5_000, Category.IF);
RoomSetting setting = new RoomSetting(5, 15_000, Category.IF);

// when
setting.updateTimeLimit(timeLimit);
Expand All @@ -102,10 +102,10 @@ class 제한_시간_설정 {
}

@ParameterizedTest
@ValueSource(ints = {4_999, 10_001, 15_001, 30_001})
@ValueSource(ints = {9_999, 15_001, 30_001, 59_999})
void 시간_제한은_특정_시간이_아니라면_예외를_던진다(int notValidTimeLimit) {
// given
RoomSetting setting = new RoomSetting(5, 5_000, Category.IF);
RoomSetting setting = new RoomSetting(5, 15_000, Category.IF);

// when & then
assertThatThrownBy(() -> setting.updateTimeLimit(notValidTimeLimit))
Expand Down

0 comments on commit 30a53ed

Please sign in to comment.