Skip to content

.beEmpty()

Asserts that an array or range contains no elements.

Examples

int[] empty;
expect(empty).to.beEmpty();
expect([]).to.beEmpty();

With Strings

expect("").to.beEmpty();

With Negation

expect([1, 2, 3]).to.not.beEmpty();
expect("hello").to.not.beEmpty();

What Failures Look Like

expect([1, 2, 3]).to.beEmpty();
ASSERTION FAILED: [1, 2, 3] should be empty.
OPERATION: beEmpty
ACTUAL: <int[]> [1, 2, 3]
EXPECTED: empty