File tree Expand file tree Collapse file tree 3 files changed +8
-6
lines changed
main/java/io/suhan/racingcar/domain
test/java/io/suhan/racingcar/domain Expand file tree Collapse file tree 3 files changed +8
-6
lines changed Original file line number Diff line number Diff line change 4
4
import io .suhan .racingcar .generator .RandomNumberGenerator ;
5
5
6
6
public class Car {
7
- private static final int CAR_MOVE_THRESHOLD = 4 ;
8
- private static final int CAR_NAME_MAXIMUM_LENGTH = 5 ;
7
+ public static final int CAR_MOVE_THRESHOLD = 4 ;
8
+ public static final int CAR_NAME_MAXIMUM_LENGTH = 5 ;
9
9
10
10
private final String name ;
11
11
private final NumberGenerator generator ;
Original file line number Diff line number Diff line change 1
1
package io .suhan .racingcar .domain ;
2
2
3
+ import static io .suhan .racingcar .domain .Car .CAR_MOVE_THRESHOLD ;
3
4
import static org .junit .jupiter .api .Assertions .assertEquals ;
4
5
import static org .junit .jupiter .api .Assertions .assertNotEquals ;
5
6
import static org .junit .jupiter .api .Assertions .assertThrows ;
@@ -23,7 +24,7 @@ public class CarTest {
23
24
24
25
@ Test
25
26
void 생성된_값이_4_이상일_경우_자동차가_움직일_수_있다 () {
26
- FixedNumberGenerator generator = new FixedNumberGenerator (4 );
27
+ FixedNumberGenerator generator = new FixedNumberGenerator (CAR_MOVE_THRESHOLD );
27
28
Car car = Car .of ("neo" , generator );
28
29
29
30
car .move ();
@@ -35,7 +36,7 @@ public class CarTest {
35
36
36
37
@ Test
37
38
void 생성된_값이_3_이하일_경우_자동차가_멈춘다 () {
38
- FixedNumberGenerator generator = new FixedNumberGenerator (3 );
39
+ FixedNumberGenerator generator = new FixedNumberGenerator (CAR_MOVE_THRESHOLD - 1 );
39
40
Car car = Car .of ("neo" , generator );
40
41
41
42
car .move ();
Original file line number Diff line number Diff line change 1
1
package io .suhan .racingcar .domain ;
2
2
3
+ import static io .suhan .racingcar .domain .Car .CAR_MOVE_THRESHOLD ;
3
4
import static org .junit .jupiter .api .Assertions .assertIterableEquals ;
4
5
import static org .junit .jupiter .api .Assertions .assertThrows ;
5
6
@@ -30,8 +31,8 @@ public class GameTest {
30
31
// given
31
32
Game game = Game .of (5 );
32
33
33
- FixedNumberGenerator forwardGenerator = new FixedNumberGenerator (4 );
34
- FixedNumberGenerator stopGenerator = new FixedNumberGenerator (3 );
34
+ FixedNumberGenerator forwardGenerator = new FixedNumberGenerator (CAR_MOVE_THRESHOLD );
35
+ FixedNumberGenerator stopGenerator = new FixedNumberGenerator (CAR_MOVE_THRESHOLD - 1 );
35
36
36
37
Car neo = Car .of ("neo" , forwardGenerator );
37
38
Car brie = Car .of ("brie" , stopGenerator );
You can’t perform that action at this time.
0 commit comments