notToEqual

fun <T> Expect<T>.notToEqual(expected: T): Expect<T>(source)

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))
}
@JvmName(name = "notToEqualNull")
fun <T : BigDecimal> Expect<T?>.notToEqual(expected: Nothing?): Expect<T>(source)

Expects that the subject of this expectation (a BigDecimal) is not null.

Return

an Expect for the subject of this expectation.

Since

1.1.0

Samples

// Use notToEqual only to check against null if your subject is a BigDecimal
// Use notToEqualNumerically or notToEqualIncludingScale if you want to compare it against another BigDecimal
expect(BigDecimal("-12345.6789") as BigDecimal?).notToEqual(null)

fails {
    expect(null as BigDecimal?).notToEqual(null)
}

fun <T : BigDecimal?> Expect<T>.notToEqual(expected: T): Nothing(source)

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)

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"))

However, if you expect it to be wrong (because BigDecimal.scale differ), then use notToEqualIncludingScale.

Since

0.17.0