David Kubecka
06/24/2024, 10:07 AMfun <T> assertEqualsRecursive(actual: T, expected: T, vararg ignoringFields: String) {
I would like to ensure that the objects passed are exactly of the same type, so that the compiler doesn't attempt any silent upcasting.CLOVIS
06/24/2024, 10:12 AMOnlyInputTypes
:
fun <@OnlyInputTypes T> assertEqualsRecursive(actual: T, expected: T, vararg ignoringFields: String) {
Since it's internal, there's a bit of setup required to use it.
Workaround 2: split your usage into two different functions. For example,
assertThat(actual)
.equalsRecursive(expected, "foo", "bar")
This way, the type is bound on the first function call. No upcasting can happen on the second function call.David Kubecka
06/24/2024, 10:20 AM