Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
object Calculator {
fun divide(a: Int, b: Int): Int {
return a / b
}
}
@RunWith(Parameterized::class)
class ParameterizedTest(
private val num1: Int,
private val num2: Int,
private val result: Int
) {
@Test
fun divideTest() {
println("$num1/$num2=$result")
assertEquals(Calculator.divide(num1, num2), result)
}
companion object {
@JvmStatic
@Parameterized.Parameters
fun testData(): Array<Array<Any>> {
return arrayOf<Array<Any>>(
arrayOf(10, 2, 5),
arrayOf(8, 4, 2),
arrayOf(100, 5, 20)
)
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.