mirror of
https://github.com/praktimarc/kst4contest.git
synced 2026-11-19 01:52:29 +01:00
Harden the setup wizard after the branch review
Written-by: Gemini 4 Hydrogen (Antigravity) Written-by: Claude Fable 5.2
This commit is contained in:
13 files changed
+248
-31
No files matched your search
+38
@@ -1,5 +1,8 @@
|
||||
package kst4contest.view;
|
||||
|
||||
import kst4contest.controller.ActiveOperatorProfile;
|
||||
import kst4contest.model.OperatorProfile;
|
||||
import kst4contest.model.OperatorProfileSelection;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertFalse;
|
||||
@@ -20,4 +23,39 @@ class ApplicationRuntimeLauncherSetupWizardTest {
|
||||
assertTrue(ApplicationRuntimeLauncher.consumeSetupWizardRequest());
|
||||
assertFalse(ApplicationRuntimeLauncher.consumeSetupWizardRequest(), "the request must not stick");
|
||||
}
|
||||
|
||||
@Test
|
||||
void switchGuardAllowsOnlyOneSwitchAtATime() {
|
||||
try {
|
||||
assertTrue(ApplicationRuntimeLauncher.beginSwitch());
|
||||
assertFalse(ApplicationRuntimeLauncher.beginSwitch(),
|
||||
"a second switch must be refused while one is in progress");
|
||||
} finally {
|
||||
ApplicationRuntimeLauncher.endSwitch();
|
||||
}
|
||||
|
||||
try {
|
||||
assertTrue(ApplicationRuntimeLauncher.beginSwitch(),
|
||||
"ending the first switch must release the guard");
|
||||
} finally {
|
||||
ApplicationRuntimeLauncher.endSwitch();
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
void rerunSetupWizardWhileSwitchInProgressReturnsFalseAndClearsRequest() {
|
||||
OperatorProfileSelection previous = ActiveOperatorProfile.get();
|
||||
OperatorProfile profile = new OperatorProfile("wizard-guard-test", "Wizard Guard Test", false, false);
|
||||
ActiveOperatorProfile.set(new OperatorProfileSelection(profile, "preferences.xml", "worked.db", false));
|
||||
assertTrue(ApplicationRuntimeLauncher.beginSwitch());
|
||||
try {
|
||||
assertFalse(ApplicationRuntimeLauncher.rerunSetupWizard());
|
||||
assertFalse(ApplicationRuntimeLauncher.consumeSetupWizardRequest(),
|
||||
"a refused rerun must not leave a wizard request behind");
|
||||
} finally {
|
||||
ApplicationRuntimeLauncher.endSwitch();
|
||||
ApplicationRuntimeLauncher.consumeSetupWizardRequest();
|
||||
ActiveOperatorProfile.set(previous);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user