public class MockConsole extends PrintStream
PrintStream
that allows you to easily capture console output.
Stores output into an internal ByteArrayOutputStream
. Note that this means you could run into memory
constraints if you heavily use this class.
Typically used in conjunction with the RestClientBuilder.console(PrintStream)
to capture console output for
testing purposes.
out
Constructor and Description |
---|
MockConsole()
Constructor.
|
Modifier and Type | Method and Description |
---|---|
FluentStringAssertion<MockConsole> |
assertContents()
Allows you to perform fluent-style assertions on the contents of this buffer.
|
FluentIntegerAssertion<MockConsole> |
assertSize()
Allows you to perform fluent-style assertions on the size of this buffer.
|
static MockConsole |
create()
Creator.
|
MockConsole |
reset()
Resets the contents of this buffer.
|
String |
toString()
Returns the contents of this buffer as a string.
|
append, append, append, checkError, clearError, close, flush, format, format, print, print, print, print, print, print, print, print, print, printf, printf, println, println, println, println, println, println, println, println, println, println, setError, write, write
write
public MockConsole()
public static MockConsole create()
MockConsole
object.public MockConsole reset()
public FluentStringAssertion<MockConsole> assertContents()
MockConsole console = MockConsole.
public FluentIntegerAssertion<MockConsole> assertSize()
MockConsole console = MockConsole.
Copyright © 2016–2020 The Apache Software Foundation. All rights reserved.