Created
April 25, 2018 20:15
-
-
Save AdamMc331/ce6b13caffab4995ff93d74d430f38ac to your computer and use it in GitHub Desktop.
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
class TestAssertion<T>(private val actual: T) { | |
fun matches(expected: T) { | |
assertEquals(expected, actual) | |
} | |
} | |
inline fun <reified T> assert(actual: T): TestAssertion<T> { | |
return TestAssertion(actual) | |
} | |
@Test | |
fun testEquals() { | |
val myList: List<Any> = listOf(3, "Adam", true) | |
assert(myList[0]).matches(3) | |
assert(myList[1]).matches("Adam") | |
assert(myList[2]).matches(true) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment