Skip to content
Permalink
Browse files

parameterise test method

  • Loading branch information
michaelbannister committed Jul 3, 2016
1 parent 0ffccf9 commit bf3e1cd3ab8f7686185b1b23ee6e4a8d4468b567
Showing with 18 additions and 4 deletions.
  1. +18 −4 src/test/kotlin/DecimalToRomanConverterTest.kt
@@ -1,10 +1,24 @@
import junitparams.JUnitParamsRunner
import junitparams.Parameters
import junitparams.naming.TestCaseName
import org.junit.Test
import org.junit.runner.RunWith
import kotlin.test.assertEquals

@RunWith(JUnitParamsRunner::class)
class DecimalToRomanConverterTest {

@Test fun `1 is written as I`() = assertEquals("I", 1.toRoman())

@Test fun `2 is written as II`() = assertEquals("II", 2.toRoman())

@Test
@TestCaseName("{0} is written as {1}")
@Parameters
fun testIntToRomanConversion(number: Int, romanRepresentation: String) {
assertEquals(romanRepresentation, number.toRoman())
}

private fun parametersForTestIntToRomanConversion() =
arrayOf(
arrayOf(1, "I"),
arrayOf(2, "II")
)
}

0 comments on commit bf3e1cd

Please sign in to comment.
You can’t perform that action at this time.