Skip to content

Commit

Permalink
Merge pull request #22 from bitPogo/feature/fix-isnot
Browse files Browse the repository at this point in the history
Fix isNot
  • Loading branch information
bitPogo authored Feb 27, 2022
2 parents 35ae125 + a2e620b commit c560d77
Show file tree
Hide file tree
Showing 2 changed files with 369 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,24 @@ import tech.antibytes.kmock.KMockContract
class isNot(
private val illegal: Any? = null
) : KMockContract.MatcherConstraint {
override fun matches(actual: Any?): Boolean = illegal != actual
override fun matches(actual: Any?): Boolean {
return !when {
illegal is Array<*> && actual is Array<*> -> illegal.contentDeepEquals(actual)
illegal is ByteArray && actual is ByteArray -> illegal.contentEquals(actual)
illegal is ShortArray && actual is ShortArray -> illegal.contentEquals(actual)
illegal is IntArray && actual is IntArray -> illegal.contentEquals(actual)
illegal is LongArray && actual is LongArray -> illegal.contentEquals(actual)
illegal is FloatArray && actual is FloatArray -> illegal.contentEquals(actual)
illegal is DoubleArray && actual is DoubleArray -> illegal.contentEquals(actual)
illegal is CharArray && actual is CharArray -> illegal.contentEquals(actual)
illegal is BooleanArray && actual is BooleanArray -> illegal.contentEquals(actual)

illegal is UByteArray && actual is UByteArray -> illegal.contentEquals(actual)
illegal is UShortArray && actual is UShortArray -> illegal.contentEquals(actual)
illegal is UIntArray && actual is UIntArray -> illegal.contentEquals(actual)
illegal is ULongArray && actual is ULongArray -> illegal.contentEquals(actual)

else -> illegal == actual
}
}
}
Loading

0 comments on commit c560d77

Please sign in to comment.