notToEqual
Expects that the subject of this
expectation is not equal to expected.
Return
an Expect for the subject of this
expectation.
Since
0.17.0
Samples
expect(2).notToEqual(3)
fails {
expect(12).notToEqual(12)
}
expect(listOf(2)).notToEqual(listOf(3))
fails {
expect(listOf(2)).notToEqual(listOf(2))
}
Deprecated
Use `notToEqualNumerically` if you expect that the following assertion is wrong: `expect(BigDecimal("10")).notToBe(BigDecimal("10.0"))` However, if you expect it to hold (because `BigDecimal.scale` differ), then use `notToEqualIncludingScale`.
Replace with
notToEqualNumerically(expected) or notToEqualIncludingScale(expected)
Content copied to clipboard
Deprecated as it would compare the subject against expected including scale -- many developers are not aware of that.
Use notToEqualNumerically if you expect that the following assertion is wrong:
expect(BigDecimal("10").notToBe(BigDecimal("10.0"))
Content copied to clipboard
However, if you expect it to be wrong (because BigDecimal.scale
differ), then use notToEqualIncludingScale.
Since
0.17.0
Samples
// only use notToEqual to check against null, otherwise use notToEqualNumerically or notToEqualIncludingScale
expect(null as BigDecimal?).notToEqual(BigDecimal("-12345.6789"))
expect(null as BigDecimal?).notToEqual(BigDecimal("1.0"))
expect(null as BigDecimal?).notToEqual(BigDecimal("25.0"))
expect(null as BigDecimal?).notToEqual(BigDecimal(-12345.6789))
expect(null as BigDecimal?).notToEqual(BigDecimal(1.0))
expect(null as BigDecimal?).notToEqual(BigDecimal(25.0))