Class MockConsole
- All Implemented Interfaces:
- Closeable,- Flushable,- Appendable,- AutoCloseable
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 RestClient.Builder.console(PrintStream) to capture console output for
 testing purposes.
 
Example:
   
See Also:
- 
Field SummaryFields inherited from class java.io.FilterOutputStreamout
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionAllows you to perform fluent-style assertions on the contents of this buffer.Allows you to perform fluent-style assertions on the size of this buffer.static MockConsolecreate()Creator.reset()Resets the contents of this buffer.toString()Returns the contents of this buffer as a string.Methods inherited from class java.io.PrintStreamappend, 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, writeBytesMethods inherited from class java.io.OutputStreamnullOutputStream
- 
Constructor Details- 
MockConsolepublic MockConsole()Constructor.
 
- 
- 
Method Details- 
createCreator.- Returns:
- A new MockConsoleobject.
 
- 
resetResets the contents of this buffer.- Returns:
- This object.
 
- 
assertContentsAllows you to perform fluent-style assertions on the contents of this buffer.Example:MockConsole console = MockConsole.create (); MockRestClient .create (MyRest.class ) .console(console ) .debug() .json5() .build() .get("/url" ) .run();console .assertContents().isContains("HTTP GET /url" );- Returns:
- A new fluent-style assertion object.
 
- 
assertSizeAllows you to perform fluent-style assertions on the size of this buffer.Example:MockConsole console = MockConsole.create (); MockRestClient .create (MyRest.class ) .console(console ) .debug() .json5() .build() .get("/url" ) .run();console .assertSize().isGreaterThan(0);- Returns:
- A new fluent-style assertion object.
 
- 
toStringReturns the contents of this buffer as a string.
 
-