Byte asserts

hasByteCount(long)

0.0.1

Use hasByteCount(long) to assert the exact number of bytes produced by the output stream, or hasByteCount(LongPredicate, String) with a custom predicate:

import org.cliassured.CliAssured;

CliAssured
    .command("echo", "Hi")
    .then()
        .stdout()
            // Assert using a custom predicate
            .hasByteCount(
                count -> count > 0,
                "Expected more than 0 bytes but found %d bytes")
    .execute()
    .assertSuccess();

isEmpty()

0.0.1

isEmpty() is a shorthand for hasByteCount(0). It asserts that the output stream produced zero bytes:

import org.cliassured.CliAssured;

CliAssured
    // The true command produces no output
    .command("true")
    .then()
        .stdout()
            // Fail unless stdout is empty (0 bytes)
            .isEmpty()
    .execute()
    .assertSuccess();