Class ScriptedIkePrompter
java.lang.Object
network.ike.plugin.support.ScriptedIkePrompter
- All Implemented Interfaces:
IkePrompter
Deterministic
IkePrompter that replays a fixed script of
answers (IKE-Network/ike-issues#385).
Primary use is unit-testing goals that prompt — construct one
with the answers the test wants, inject it, and the goal runs
without any real I/O. Each prompt / confirm /
select call consumes the next scripted answer.
It is shipped (not test-scoped) so both plugins' test suites can share it.
-
Constructor Summary
ConstructorsConstructorDescriptionScriptedIkePrompter(String... answers) Creates a prompter that replays the given answers in order. -
Method Summary
Modifier and TypeMethodDescriptionbooleanPrompts for a yes/no confirmation.booleanWhether an interactive input channel is available.Prompts for a free-text line of input.Prompts for a numbered selection from a list.
-
Constructor Details
-
ScriptedIkePrompter
Creates a prompter that replays the given answers in order.- Parameters:
answers- the answers each prompt call returns, in order
-
-
Method Details
-
isInteractive
public boolean isInteractive()Description copied from interface:IkePrompterWhether an interactive input channel is available.False in genuine non-interactive contexts (Maven batch mode); a goal should then fail with a
-D<param>=instruction rather than prompt.- Specified by:
isInteractivein interfaceIkePrompter- Returns:
- true when prompting is possible
-
prompt
Description copied from interface:IkePrompterPrompts for a free-text line of input.- Specified by:
promptin interfaceIkePrompter- Parameters:
label- the prompt label, including any trailing separator (e.g."Commit message: ")- Returns:
- the entered line (trimmed), or
nullif input was blank, end-of-stream, or not interactive
-
confirm
Description copied from interface:IkePrompterPrompts for a yes/no confirmation.- Specified by:
confirmin interfaceIkePrompter- Parameters:
label- the questiondefaultYes- the answer assumed on blank input or a non-interactive context- Returns:
- the user's choice, or
defaultYesas the default
-
select
Description copied from interface:IkePrompterPrompts for a numbered selection from a list.- Specified by:
selectin interfaceIkePrompter- Parameters:
label- the selection headeroptions- the choices, rendered as a numbered list- Returns:
- the chosen option, or
nullon invalid, blank, or non-interactive input
-