public static AbstractAnnotationSpec.Test
Marks a function to be executed as a Test
This can be used in AnnotationSpec to mark a function to be executed as a test by KotlinTest Engine.
AbstractAnnotationSpec.Test.expected can be used to mark a test to expect a specific exception.
This is useful when moving from JUnit, in which you use expected to verify for an exception.
@Test(expected = FooException::class)
fun foo() {
throw FooException() // Pass
}
@Test(expected = FooException::class
fun bar() {
throw BarException() // Fails, FooException was expected
}
AbstractAnnotationSpec.Test.expected| Modifier and Type | Method and Description |
|---|---|
java.lang.Class<? extends java.lang.Throwable> |
expected() |