Last active
January 2, 2020 16:18
-
-
Save erikhuizinga/ee19aeaf06140b49e9e4f6ea7213ccad to your computer and use it in GitHub Desktop.
This file contains hidden or 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
package com.example | |
import org.junit.Assert.assertEquals | |
import org.junit.Assert.assertThrows | |
import org.junit.Test | |
import org.junit.function.ThrowingRunnable | |
/** | |
* JUnit 4.13 test | |
*/ | |
class `JUnit 4 dot 13 Test` { | |
@Test | |
fun `use assertThrows`() { | |
val message = "Hello, World!" | |
val actual = assertThrows( | |
RuntimeException::class.java, | |
ThrowingRunnable { throw RuntimeException(message) } | |
) | |
assertEquals(message, actual.message) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Link back to corresponding Android Studio JUnit 4.13 issue on the Google Issue Tracker: https://issuetracker.google.com/issues/147066405.