-
-
Save hector6872/83ce6e7d8ec612aef814f4e2c4ac2420 to your computer and use it in GitHub Desktop.
Parameterized JUnit4 test example in Kotlin
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@RunWith(Parameterized::class) | |
class KotlinTest(val paramOne: Int, val paramTwo: String) { | |
companion object { | |
@JvmStatic | |
@Parameterized.Parameters | |
fun data() : Collection<Array<Any>> { | |
return listOf( | |
arrayOf(1, "I"), // First test: (paramOne = 1, paramTwo = "I") | |
arrayOf(1999, "MCMXCIX") // Second test: (paramOne = 1999, paramTwo = "MCMXCIX") | |
) | |
} | |
} | |
@Test | |
fun shouldReturnExpectedRomanForArabic() { | |
assertThat(RomanNumeralGenerator().arabicToRoman(paramOne), equalTo(paramTwo)); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment