CLI Assured 0.1.0 release notes
Enhancements
Access captured output through CommandResult
CommandResult now exposes stdout() and stderr() methods returning a new StreamResult object.
StreamResult provides access to:
-
lines()- the captured output lines as aStream<String> -
bytes()- the raw captured output as abyte[] -
lineCount()- the number of captured lines -
byteCount()- the number of captured bytes
CommandSpec.lines() shorthand
A new CommandSpec.lines() method serves as a shorthand for the common pattern of executing a command,
redirecting stderr to stdout, capturing all output, asserting success, and returning the stdout lines.
Here is an example:
Stream<String> lines = CliAssured.command("my-command").lines();
CommandSpec.bytes() shorthand
Similarly, CommandSpec.bytes() provides a shorthand for capturing raw output bytes:
byte[] bytes = CliAssured.command("my-command").bytes();
IoConsumer for stdin producers
CommandSpec.stdin(…) now accepts an IoConsumer<OutputStream> instead of Consumer<OutputStream>.
IoConsumer is a @FunctionalInterface whose accept method declares throws IOException,
eliminating the need to wrap I/O exceptions in UncheckedIOException.
CLI Assured documentation published on https://cli-assured.org/
The Antora documentation is published on https://cli-assured.org/ and covers
-
Release notes - Release notes documents for the past releases
-
API Reference - full list of supported features and use cases
Deprecations
-
CommandResult.byteCountStdout()- usestdout().byteCount()instead -
CommandResult.byteCountStderr()- usestderr().byteCount()instead
Breaking changes
CommandSpec.stdin(Consumer<OutputStream>) changed to CommandSpec.stdin(IoConsumer<OutputStream>)
The stdin(…) method now accepts IoConsumer<OutputStream> instead of Consumer<OutputStream>.
Lambda expressions work without changes, but code passing an explicit Consumer<OutputStream> variable
will need to be updated.