Package org.elasticsearch.cli
Class MockTerminal
java.lang.Object
org.elasticsearch.cli.Terminal
org.elasticsearch.cli.MockTerminal
A terminal for tests which captures all output, and
can be plugged with fake input.
-
Nested Class Summary
Nested classes/interfaces inherited from class org.elasticsearch.cli.Terminal
Terminal.Verbosity
-
Field Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addBinaryInput
(byte[] bytes) Adds a binary input that will be returned from reading this Terminal.void
addSecretInput
(String input) Adds a character input that will be returned from reading a secret from this Terminal.void
addTextInput
(String input) Adds a character input that will be returned from reading this Terminal.static MockTerminal
create()
Returns all output written to this terminal.Returns all output written to this terminal.byte[]
Returns all bytes written to this terminal.void
reset()
Wipes the input and output.void
setSupportsBinary
(boolean supportsBinary) Methods inherited from class org.elasticsearch.cli.Terminal
errorPrint, errorPrintln, errorPrintln, flush, getErrorWriter, getReader, getVerbosity, getWriter, isHeadless, isPrintable, print, print, println, println, promptYesNo, readLineToCharArray, readSecret, readText, setVerbosity
-
Method Details
-
getInputStream
- Overrides:
getInputStream
in classTerminal
-
getOutputStream
- Overrides:
getOutputStream
in classTerminal
-
create
-
addTextInput
Adds a character input that will be returned from reading this Terminal. Values are read in FIFO order. -
addSecretInput
Adds a character input that will be returned from reading a secret from this Terminal. Values are read in FIFO order. -
addBinaryInput
public void addBinaryInput(byte[] bytes) Adds a binary input that will be returned from reading this Terminal. Values are read in FIFO order. -
getOutput
Returns all output written to this terminal. -
getOutputBytes
public byte[] getOutputBytes()Returns all bytes written to this terminal. -
getErrorOutput
Returns all output written to this terminal. -
setSupportsBinary
public void setSupportsBinary(boolean supportsBinary) -
reset
public void reset()Wipes the input and output.
-