notToBeAnInstanceOf
Expects that the subject of this
expectation is not a TNotExpected (the same type or a sub-type).
Notice, this function has only one type parameter in order that you do not have to restate the type of the current subject. But that also means that we need to return Expect<*>
or in other words, we loose the type of the subject. Which means, if you want to state a further expectation after notToBeAnInstanceOf then you most likely want to use the overload which expects one (or more) KClass instead which keeps the type of the initial subject.
Return
an Expect for the subject of this
expectation but untyped (with a star projection).
Since
1.1.0
Parameters
the type which we do not expect to be the same or a super-type of the subject of this
expectation.
Samples
val n: Number = 16L
expect(n).notToBeAnInstanceOf<Int>()
fails {
// fails because n is actually instance of Long
expect(n).notToBeAnInstanceOf<Long>()
}
Expects that the subject of this
expectation is not the given type neither one of the otherTypes (the same type or a sub-type).
Return
an Expect for the subject of this
expectation.
Since
1.1.0
Parameters
one of the types which we do not expect to be the same or a super-type of the subject of this
expectation.
all types which we do not expect to be the same or a super-type of the subject of this
expectation.
Samples
val n: Number = 16L
expect(n).notToBeAnInstanceOf(Int::class, Float::class, Double::class)
fails {
// fails because n is actually instance of Long
expect(n).notToBeAnInstanceOf(Int::class, Long::class)
}