Slide 10
Slide 10 text
Theoryテストでハマる!
data class Fixture(val a: Int, val b: Int,
val expected: Int)
@RunWith(Theories::class)
class CalculatorTest {
private val sut = Calculator()
@DataPoints
fun getFixtures() = arrayOf(Fixture(1, 2, 3))
@Test fun `足し算結果を返すこと`(fixture: Fixture) {
val got = sut.plus(fixture.a, fixture.b)
assertThat(got).isEqualTo(fixture.expected)
}
}
java.lang.Error: DataPoint field fixtures must be static