Skip to content

Instantly share code, notes, and snippets.

@ProArun
Created August 19, 2023 14:13
Show Gist options
  • Save ProArun/f7f8142e4a70dd44389bb4db960ce376 to your computer and use it in GitHub Desktop.
Save ProArun/f7f8142e4a70dd44389bb4db960ce376 to your computer and use it in GitHub Desktop.
parameterized Test Case
@RunWith(value = Parameterized::class)
class ParameterizedExample(val input:String,val expectedValue:Boolean){
@Test
fun test(){
val helper = Helper()
val result = helper.isPallindrome(input)
assertEquals(expectedValue,result)
}
companion object{
@JvmStatic
@Parameterized.parameters(name = "{index} : {0} is pallindrome - {1}")
fun data():List<Array<Any>>{
return ListOf(
arrayOf("hello",false),
arrayOf("level",true),
arrayOf("a",true),
arrayOf("",true)
)
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment