From 371b55bd658aa4ff457ebd9662c4c2dce4273f41 Mon Sep 17 00:00:00 2001 From: fdai7012 Date: Thu, 8 Feb 2024 17:31:55 +0100 Subject: [PATCH] added test for visualizer showing lives --- .../VisualizerPlainTextUltraTest.java | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/src/test/java/pacmanTests/VisualizerPlainTextUltraTest.java b/src/test/java/pacmanTests/VisualizerPlainTextUltraTest.java index 052d9c5..afbc632 100644 --- a/src/test/java/pacmanTests/VisualizerPlainTextUltraTest.java +++ b/src/test/java/pacmanTests/VisualizerPlainTextUltraTest.java @@ -124,4 +124,24 @@ class VisualizerPlainTextUltraTest { // assert 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); + } }