forked from woowacourse/kotlin-racingcar
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CarTest.kt
35 lines (30 loc) · 732 Bytes
/
CarTest.kt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
import model.Car
import org.assertj.core.api.Assertions.assertThat
import org.junit.jupiter.api.Test
import org.junit.jupiter.api.assertThrows
class CarTest {
@Test
fun initTest() {
val car = Car("dool")
assertThat(car.name).isEqualTo("dool")
assertThat(car.position).isEqualTo(0)
}
@Test
fun getInfoExceptionTest() {
assertThrows<IllegalArgumentException> {
Car("dooly", 0)
}
}
@Test
fun moveTest() {
val car = Car("dool")
car.move(3)
assertThat(car.position).isEqualTo(0)
}
@Test
fun dontMoveTest() {
val car = Car("dool")
car.move(4)
assertThat(car.position).isEqualTo(1)
}
}