File tree 2 files changed +19
-0
lines changed
main/java/de/cotto/bitbook/wizard/cli
test/java/de/cotto/bitbook/wizard/cli
2 files changed +19
-0
lines changed Original file line number Diff line number Diff line change @@ -28,6 +28,13 @@ public void exitWizard() {
28
28
promptChangeListener .changePromptToDefault ();
29
29
}
30
30
31
+ public Availability wizardAvailability () {
32
+ if (wizardService .isEnabled ()) {
33
+ return Availability .unavailable ("wizard is active" );
34
+ }
35
+ return Availability .available ();
36
+ }
37
+
31
38
public Availability exitWizardAvailability () {
32
39
if (wizardService .isEnabled ()) {
33
40
return Availability .available ();
Original file line number Diff line number Diff line change @@ -37,6 +37,11 @@ void exit_wizard_command_initially_not_available() {
37
37
assertThat (wizardCommands .exitWizardAvailability ().isAvailable ()).isEqualTo (false );
38
38
assertThat (wizardCommands .exitWizardAvailability ().getReason ()).isEqualTo ("wizard is not active" );
39
39
}
40
+
41
+ @ Test
42
+ void wizard_command_initially_available () {
43
+ assertThat (wizardCommands .wizardAvailability ().isAvailable ()).isEqualTo (true );
44
+ }
40
45
}
41
46
42
47
@ Nested
@@ -64,5 +69,12 @@ void exit_wizard_notifies_service() {
64
69
wizardCommands .exitWizard ();
65
70
verify (wizardService ).disableWizard ();
66
71
}
72
+
73
+ @ Test
74
+ void start_wizard_command_not_available () {
75
+ when (wizardService .isEnabled ()).thenReturn (true );
76
+ assertThat (wizardCommands .wizardAvailability ().isAvailable ()).isEqualTo (false );
77
+ assertThat (wizardCommands .wizardAvailability ().getReason ()).isEqualTo ("wizard is active" );
78
+ }
67
79
}
68
80
}
You can’t perform that action at this time.
0 commit comments