Package org.elasticsearch.cli
Class MockTerminal
java.lang.Object
org.elasticsearch.cli.Terminal
org.elasticsearch.cli.MockTerminal
public class MockTerminal
extends org.elasticsearch.cli.Terminal
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
org.elasticsearch.cli.Terminal.Verbosity
-
Field Summary
Fields inherited from class org.elasticsearch.cli.Terminal
DEFAULT
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
addSecretInput(String input)
Adds an an input that will be return fromreadSecret(String)
.void
addTextInput(String input)
Adds an an input that will be return fromreadText(String)
.Returns all output written to this terminal.Returns all output written to this terminal.char[]
readSecret(String prompt)
void
reset()
Wipes the input and output.Methods inherited from class org.elasticsearch.cli.Terminal
errorPrint, errorPrintln, errorPrintln, flush, isPrintable, print, println, println, promptYesNo, readLineToCharArray, readSecret, setVerbosity
-
Constructor Details
-
MockTerminal
public MockTerminal()
-
-
Method Details
-
readText
- Specified by:
readText
in classorg.elasticsearch.cli.Terminal
-
readSecret
- Specified by:
readSecret
in classorg.elasticsearch.cli.Terminal
-
getWriter
- Specified by:
getWriter
in classorg.elasticsearch.cli.Terminal
-
getErrorWriter
- Overrides:
getErrorWriter
in classorg.elasticsearch.cli.Terminal
-
addTextInput
Adds an an input that will be return fromreadText(String)
. Values are read in FIFO order. -
addSecretInput
Adds an an input that will be return fromreadSecret(String)
. Values are read in FIFO order. -
getOutput
Returns all output written to this terminal.- Throws:
UnsupportedEncodingException
-
getErrorOutput
Returns all output written to this terminal.- Throws:
UnsupportedEncodingException
-
reset
public void reset()Wipes the input and output.
-