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 TypeMethodDescriptionvoidaddBinaryInput(byte[] bytes) Adds a binary input that will be returned from reading this Terminal.voidaddSecretInput(String input) Adds a character input that will be returned from reading a secret from this Terminal.voidaddTextInput(String input) Adds a character input that will be returned from reading this Terminal.static MockTerminalcreate()Returns all output written to this terminal.Returns all output written to this terminal.byte[]Returns all bytes written to this terminal.voidreset()Wipes the input and output.voidsetSupportsBinary(boolean supportsBinary) Methods inherited from class org.elasticsearch.cli.Terminal
asLineOutputStream, errorPrint, errorPrintln, errorPrintln, errorPrintln, errorPrintln, errorPrintln, flush, getReader, getVerbosity, isHeadless, isPrintable, print, print, println, println, promptYesNo, readLineToCharArray, readSecret, readText, setVerbosity
-
Method Details
-
getInputStream
- Overrides:
getInputStreamin classTerminal
-
getOutputStream
- Overrides:
getOutputStreamin 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.
-