Browse Source

added test for visualizer showing lives

main
fdai7012 11 months ago
parent
commit
371b55bd65
  1. 20
      src/test/java/pacmanTests/VisualizerPlainTextUltraTest.java

20
src/test/java/pacmanTests/VisualizerPlainTextUltraTest.java

@ -124,4 +124,24 @@ class VisualizerPlainTextUltraTest {
// assert // assert
assertThat(result).startsWith("\nSCORE: 100"); assertThat(result).startsWith("\nSCORE: 100");
} }
@Test
void VisualizerPlainTextUtlra_lives_areVisualized() {
// arrange
GameManager gameManager = new GameManager();
VisualizerPlainTextUltra vptu = new VisualizerPlainTextUltra(gameManager);
vptu.showScore = true;
gameManager.score = 100;
String expected = "\nSCORE: " + gameManager.score + " LIVES: " + gameManager.livesRemaining + "\n\n";
// act
vptu.Update();
String result = (String)vptu.GetOutput();
// assert
assertThat(result).startsWith(expected);
}
} }
Loading…
Cancel
Save