### Question:
S2Controller extends DefaultSubscriber<Response> { public static Builder starcraft2Game() { return new Builder(); } private  S2Controller(Config config); static Builder starcraft2Game(); S2Controller untilReady(); void stop(); boolean stopAndWait(); boolean stopAndWait(long timeoutInMillis); void isInState(GameStatus expectedStatus); boolean inState(GameStatus expectedStatus); Config getConfig(); @Override void onNext(Response response); @Override void onComplete(); @Override void onError(Throwable e); S2Controller relaunchIfNeeded(int baseBuild, String dataVersion); void restart(); Process getS2Process();  }### Answer:
@Test void throwsExceptionWhenExecuteInfoIsNotFound() { assertThatExceptionOfType(StarCraft2ControllerException.class) .isThrownBy(() -> starcraft2Game().getGameConfiguration()) .withMessage("Invalid argument was provided") .withCause(new IllegalArgumentException("ExecuteInfo.txt is required")); }
@Test void throwsExceptionWhenExecutablePathDoesNotExist() { asWindows(); userHome.newFile(WIN_USER_DIR.resolve("Starcraft II"), EXECUTE_INFO_TXT); assertThatExceptionOfType(StarCraft2ControllerException.class) .isThrownBy(() -> starcraft2Game().getGameConfiguration()) .withMessage("Invalid argument was provided") .withCause(new IllegalArgumentException("executable path is required")); }
@Test void throwsExceptionWhenExecutablePathIsTooShort() { asWindows(); userHome.newFile(WIN_USER_DIR.resolve("Starcraft II"), EXECUTE_INFO_TXT); assertThatExceptionOfType(StarCraft2ControllerException.class) .isThrownBy(() -> starcraft2Game().withExecutablePath(Paths.get("sc2")).getGameConfiguration()) .withMessage("Invalid path to the executable file: sc2"); }
@Test void managesConfigurationOfManyGameInstances() throws IOException { asWindows(); initStarcraft2Executable(WIN_USER_DIR); Config instance01 = starcraft2Game().getGameConfiguration(); Config instance02 = starcraft2Game().getGameConfiguration(); Config instance03 = starcraft2Game().getGameConfiguration(); Config instance04 = starcraft2Game().getGameConfiguration(); Config instance05 = starcraft2Game().getGameConfiguration(); assertThat(instance01.getInt(GAME_WINDOW_X)).as("game instance 01 window.x").isEqualTo(CFG_WINDOW_X); assertThat(instance01.getInt(GAME_WINDOW_Y)).as("game instance 01 window.y").isEqualTo(CFG_WINDOW_Y); assertThat(instance02.getInt(GAME_WINDOW_X)).as("game instance 02 window.x") .isEqualTo(CFG_WINDOW_X + CFG_WINDOW_W); assertThat(instance02.getInt(GAME_WINDOW_Y)).as("game instance 02 window.y").isEqualTo(CFG_WINDOW_Y); assertThat(instance03.getInt(GAME_WINDOW_X)).as("game instance 03 window.x").isEqualTo(CFG_WINDOW_X); assertThat(instance03.getInt(GAME_WINDOW_Y)).as("game instance 03 window.y") .isEqualTo(CFG_WINDOW_Y + CFG_WINDOW_H); assertThat(instance04.getInt(GAME_WINDOW_X)).as("game instance 04 window.x") .isEqualTo(CFG_WINDOW_X + CFG_WINDOW_W); assertThat(instance04.getInt(GAME_WINDOW_Y)).as("game instance 04 window.y") .isEqualTo(CFG_WINDOW_Y + CFG_WINDOW_H); assertThat(instance05.getInt(GAME_WINDOW_X)).as("game instance 05 window.x").isEqualTo(CFG_WINDOW_X); assertThat(instance05.getInt(GAME_WINDOW_Y)).as("game instance 05 window.y").isEqualTo(CFG_WINDOW_Y); }