|
|
@ -18,12 +18,10 @@ class VisualizerPlainTextUltraTest { |
|
|
|
"e.e", |
|
|
|
"w.w" |
|
|
|
}; |
|
|
|
|
|
|
|
GameManager gameManager = new GameManager(); |
|
|
|
gameManager.map = new Map(mapTest, gameManager); |
|
|
|
VisualizerPlainTextUltra vptu = new VisualizerPlainTextUltra(gameManager); |
|
|
|
vptu.showScore = false; |
|
|
|
|
|
|
|
String expected = "" |
|
|
|
+ "|''| . |''|\n" |
|
|
|
+ "|__| |__|\n" |
|
|
@ -46,14 +44,11 @@ class VisualizerPlainTextUltraTest { |
|
|
|
"e.e", |
|
|
|
"w.w" |
|
|
|
}; |
|
|
|
|
|
|
|
GameManager gameManager = new GameManager(); |
|
|
|
gameManager.map = new Map(mapTest, gameManager); |
|
|
|
VisualizerPlainTextUltra vptu = new VisualizerPlainTextUltra(gameManager); |
|
|
|
vptu.showScore = false; |
|
|
|
|
|
|
|
gameManager.ghosts[0].position = new Vector2(1, 1); |
|
|
|
|
|
|
|
String expected = "" |
|
|
|
+ "|''| . |''|\n" |
|
|
|
+ "|__| |__|\n" |
|
|
@ -89,20 +84,15 @@ class VisualizerPlainTextUltraTest { |
|
|
|
"w.w", |
|
|
|
"w.w" |
|
|
|
}; |
|
|
|
|
|
|
|
GameManager gameManager = new GameManager(); |
|
|
|
gameManager.map = new Map(mapTest, gameManager); |
|
|
|
VisualizerPlainTextUltra vptu = new VisualizerPlainTextUltra(gameManager); |
|
|
|
vptu.showScore = false; |
|
|
|
|
|
|
|
gameManager.Pause(); |
|
|
|
|
|
|
|
String expectedEnd = " Paused! \n\n"; |
|
|
|
|
|
|
|
// act |
|
|
|
vptu.Update(); |
|
|
|
String result = (String)vptu.GetOutput(); |
|
|
|
|
|
|
|
// assert |
|
|
|
assertThat(result).endsWith(expectedEnd); |
|
|
|
} |
|
|
@ -110,18 +100,14 @@ class VisualizerPlainTextUltraTest { |
|
|
|
@Test |
|
|
|
void VisualizerPlainTextUtlra_score_isVisualized() { |
|
|
|
// arrange |
|
|
|
|
|
|
|
GameManager gameManager = new GameManager(); |
|
|
|
VisualizerPlainTextUltra vptu = new VisualizerPlainTextUltra(gameManager); |
|
|
|
vptu.showScore = true; |
|
|
|
|
|
|
|
gameManager.score = 100; |
|
|
|
|
|
|
|
String expected = "\nSCORE: 100"; |
|
|
|
// act |
|
|
|
vptu.Update(); |
|
|
|
String result = (String)vptu.GetOutput(); |
|
|
|
|
|
|
|
// assert |
|
|
|
assertThat(result).startsWith(expected); |
|
|
|
} |
|
|
@ -129,19 +115,14 @@ class VisualizerPlainTextUltraTest { |
|
|
|
@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); |
|
|
|
} |
|
|
|