and I'm facing an issue in testing a specific use case. Here is a simplified version of the test case I want to run.
Copy code
@Test(expected = NullPointerException::class)
fun test() = runTest {
//In my actual code, I'm testing a ViewModel which uses viewModelScope to launch a coroutine
//and it will throw an exception for a specific case.
val scope = CoroutineScope(SupervisorJob() + Dispatchers.Main.immediate)
scope.launch {
throw NullPointerException("error")
}
}