Bug 523

Summary: It is found that, after the game is forced to stop, the status "gameStarted" is not be set to false
Product: CS3343 2020 Group 9_Chinese Chess Reporter: FENG Yi <yfeng28-c>
Component: ChessGameAssignee: Marco <kaipewang2-c>
Status: CONFIRMED ---    
Severity: enhancement CC: guohan2-c, kaipewang2-c, longtduan2-c, yfeng28-c, yinuowang3-c, yujiawang7-c
Priority: ---    
Version: V2.0   
Hardware: PC   
OS: Mac OS   
Deadline: 2020-11-13   

Description FENG Yi 2020-12-06 15:33:50 HKT
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!
Comment 1 DUAN Longteng 2020-12-06 23:15:56 HKT
(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.