Created
February 10, 2018 11:04
-
-
Save aanandshekharroy/5b2e0a0fb510aa0cf137c9d2cae4572a to your computer and use it in GitHub Desktop.
Used JUnitParams to create parametrized unit test in Kotlin
This file contains 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
import junitparams.JUnitParamsRunner | |
import junitparams.Parameters | |
import org.junit.Test; | |
import org.junit.Assert.*; | |
import org.junit.Before | |
import org.junit.runner.RunWith | |
import org.junit.runners.Parameterized | |
import java.util.* | |
@RunWith(JUnitParamsRunner::class) | |
class TestingModuleTest { | |
lateinit var a :TestingModule | |
@Before | |
fun setUp(){ | |
a = TestingModule() | |
} | |
fun getReverseStringData() = arrayOf(arrayOf("abc","cba"),arrayOf("aab","baa")) | |
@Test | |
@Parameters(method = "getReverseStringData") | |
fun testReverse(input:String,expected:String){ | |
assertEquals(expected,a.reverse(input)) | |
} | |
} |
it's great, thanks for sharing
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Made it public