Steps to Reproduce: If test cases in the other file have been run before the test algoTest0() (code is below) @Test public void algoTest0() throws Exception { // Game Not Start for CmdHelp ChessBoard board = ChessBoard.getInstance(); board.stopGame(); setOutput(); CommandHandler.inputCommand(new String[]{"help"}); assertEquals(true, getOutput().contains("The game has not started yet!")); } Actual Result: The console prompt "The game is over! Help function is not allowed. Please start a new game." Expected Result: The game has not started yet!
(In reply to FENG Yi from comment #0) > Steps to Reproduce: > > If test cases in the other file have been run before the test algoTest0() > (code is below) > > @Test > public void algoTest0() throws Exception { // Game Not Start for CmdHelp > ChessBoard board = ChessBoard.getInstance(); > board.stopGame(); > setOutput(); > CommandHandler.inputCommand(new String[]{"help"}); > assertEquals(true, getOutput().contains("The game has not started yet!")); > } > > Actual Result: > The console prompt "The game is over! Help function is not allowed. Please > start a new game." > > Expected Result: > The game has not started yet! The bug is located at the stopGame() function in ChessBoard.java. It does not change the isStart value to false, which will lead to wrong output of this test case. Now new logic is added to make isStart false, the bug is resolved.