티스토리 뷰

728x90
@Test
fun `should test suspending functions`() = runBlockingTest {
    assertThrows<IllegalStateException> { failing() }
}

https://github.com/junit-team/junit5/issues/1851#issuecomment-640510865

 

Support assertThrows() with suspending functions in Kotlin · Issue #1851 · junit-team/junit5

Often when I write a unit test that has to assert that a certain exception is thrown I use the assertThrows() method. But I find myself regularly having to test suspending functions, so I have to w...

github.com

 

728x90
댓글