im using a sealed class to report back success or error to client code:
sealed class Result<out T : Any> {
data class Success<out T : Any>(val data: T) : Result<T>()
data class Error(val exception: Exception) : Result<Nothing>()
}
But im stuck getting even the simplest unit test to compile using it:
val error = Result.Error(IOException("message"))
assertThat(error, instanceOf(Result.Error::class.java))
I get the message : Type Inference failed. Not enough information to infer parameter T in fun instanceOf(type : Class<*>) : Matcher!
Looks like im missing something important in Kotlin.
Thanks for helping me out!