OutputCaptureExtension makes the stdout and stderr available as giant strings; more often than not, the test only cares about some lines and has to split the string by newline.
Consider adding methods to return Stream<String>
to avoid the aforementioned boilerplate.
Comment From: wilkinsona
Thanks for the suggestion but I don't think we should do this as it would mean that CapturedOutput
was taking on two responsibilities. Furthermore, with Java 11 or later the conversion is a single call to String.lines()
. If you can't use Java 11 or later, a static utility method can fill the gap for you in the meantime.