notToBeEmpty

Expects that the subject of this expectation (a CharSequence) CharSequence.kotlin.text.isNotEmpty.

Return

an Expect for the subject of this expectation.

Since

0.17.0

Samples

expect("XYZ").notToBeEmpty()

fails {
    expect("").notToBeEmpty()
}

// use notToBeBlank to check for whitespaces
expect(" ").notToBeEmpty()

Expects that the subject of this expectation (a Collection) is not an empty Collection.

Return

an Expect for the subject of this expectation.

Samples

expect(listOf(1, 2, 3)).notToBeEmpty()

fails {
    expect(emptyList<Int>()).notToBeEmpty()
}

fun <T : Map<*, *>> Expect<T>.notToBeEmpty(): Expect<T>(source)

Expects that the subject of this expectation (a Map) is not an empty Map.

Return

an Expect for the subject of this expectation.

Since

0.17.0

Samples

expect(mapOf(1 to "a")).notToBeEmpty()

fails { // because the map is empty
    expect(emptyMap<Int, String>()).notToBeEmpty()
}