Package org.springframework.shell.test
Interface ShellTestClient
- All Superinterfaces:
AutoCloseable,Closeable
- All Known Implementing Classes:
ShellTestClient.DefaultShellClient
Client for terminal session which can be used as a programmatic way to interact with a
shell application. In a typical test it is required to write into a shell and read what
is visible in a shell.
- Author:
- Janne Valkealahti
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic interfacestatic classBuilder interface forShellClient.static classstatic classstatic classstatic interfacestatic interfacestatic classstatic final record -
Method Summary
Modifier and TypeMethodDescriptionstatic ShellTestClient.Builderbuilder(TerminalSession terminalSession, PromptProvider promptProvider, org.jline.reader.LineReader lineReader, org.jline.terminal.Terminal terminal, org.jline.reader.Parser parser) Get an instance of a builder.Run interactive shell session.nonInteractive(String... args) Run non-interactive command session.screen()Read the screen.
-
Method Details
-
interactive
ShellTestClient.InteractiveShellSession interactive()Run interactive shell session.- Returns:
- session for chaining
-
nonInteractive
Run non-interactive command session.- Parameters:
args- the command arguments- Returns:
- session for chaining
-
screen
ShellScreen screen()Read the screen.- Returns:
- the screen
-
builder
static ShellTestClient.Builder builder(TerminalSession terminalSession, PromptProvider promptProvider, org.jline.reader.LineReader lineReader, org.jline.terminal.Terminal terminal, org.jline.reader.Parser parser) Get an instance of a builder.- Parameters:
terminalSession- the terminal sessionpromptProvider- the prompt providerlineReader- the line readerterminal- the terminal- Returns:
- a Builder
-