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 TypeMethodDescriptionvoidaddSecretInput(String input)Adds an an input that will be return fromreadSecret(String).voidaddTextInput(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)voidreset()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:
readTextin classorg.elasticsearch.cli.Terminal
-
readSecret
- Specified by:
readSecretin classorg.elasticsearch.cli.Terminal
-
getWriter
- Specified by:
getWriterin classorg.elasticsearch.cli.Terminal
-
getErrorWriter
- Overrides:
getErrorWriterin 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.
-