Any way to force a static method to be generated in a kotlin class?

As a much nicer alternative, use GitHub - Pragmatists/JUnitParams: Parameterised tests that don't suck
No more static methods / companion object code bloat.

A full example:

@RunWith(JUnitParamsRunner::class)
class ToSentenceCaseTest {

    @Test
    @Parameters
    fun test(input: String, expected: String) {
        assertThat(
                input.toSentenceCase()
        ).isEqualTo(
                expected
        )
    }

    fun parametersForTest() = arrayOf(
            arrayOf(""              , "" ),
            arrayOf("a"             , "A"),
            arrayOf("word"          , "Word"),
            arrayOf("multiple Words", "Multiple words")
    )

}
1 Like