notToContain

Starts a sophisticated toContain assertion building process based on this Expect and already chooses a NotCheckerStep.

Return

The newly created builder.

Since

0.17.0

Parameters

o

The filler object o.

Samples

expect("ABC") notToContain o value "X"

fails {
    expect("ABC") notToContain o value "B"
}

Expects that the subject of this expectation (a CharSequence) does not contain expected's toString representation.

It is a shortcut for noToContain o value expected.

Notice that a runtime check applies which assures that only CharSequence, Number and Char are passed. This function expects CharSequenceOrNumberOrChar (which is a typealias for Any) for your convenience, so that you can mix String and Int for instance.

Return

an Expect for the subject of this expectation.

Since

0.17.0

Samples

expect("ABC") notToContain "X"

expect("ABC") notToContain values("X", 'Y', 1)

fails {
    expect("ABC") notToContain "B"
}

fails {
    expect("ABC") notToContain values("B", "X")
}

Expects that the subject of this expectation (a CharSequence) does not contain the toString representation of the given values.

It is a shortcut for notToContain o the values(expected, *otherExpected).

Notice that a runtime check applies which assures that only CharSequence, Number and Char are passed. This function expects CharSequenceOrNumberOrChar (which is a typealias for Any) for your convenience, so that you can mix String and Int for instance.

Return

an Expect for the subject of this expectation.

Since

0.17.0

Parameters

values

The values which should not be found -- use the function values(t, ...) to create a Values.

Samples

expect("ABC") notToContain "X"

expect("ABC") notToContain values("X", 'Y', 1)

fails {
    expect("ABC") notToContain "B"
}

fails {
    expect("ABC") notToContain values("B", "X")
}

Starts a sophisticated toContain assertion building process based on this Expect and already chooses a NotCheckerStep.

Return

The newly created builder.

Since

0.17.0

Parameters

o

The filler object o.

Samples

expect(listOf("A", "B")) notToContain o elementsOf setOf("C", "D")

fails {
    expect(listOf(1, 8, 5)) notToContain o entry {
        it toBeGreaterThan 6
    }
}

infix fun <E, T : Iterable<E>> Expect<T>.notToContain(expected: E): Expect<T>(source)

Expects that the subject of this expectation (an Iterable) has at least one element and that it does not contain the expected value.

It is a shortcut for notToContain o value expected

Return

an Expect for the subject of this expectation.

Since

0.17.0

Samples

expect(listOf("A", "B", "C")) notToContain "D"

fails {
    expect(listOf("A", "B", "C")) notToContain "A"
}

infix fun <E, T : Iterable<E>> Expect<T>.notToContain(values: Values<E>): Expect<T>(source)

Expects that the subject of this expectation (an Iterable) has at least one element and that it does not contain the expected values.

It is a shortcut for notToContain o the values(...)

Return

an Expect for the subject of this expectation.

Since

0.17.0

Parameters

values

The values which should not be contained within the Iterable -- use the function values(t, ...) to create a Values.

Samples

expect(listOf("A", "B", "C")) notToContain values("D", "E")

fails {
    expect(listOf("A", "B", "C")) notToContain values("A", "D")
}