Browse Source

refactoring: formatting

main
fdai7012 11 months ago
parent
commit
174b2f8343
  1. 21
      src/test/java/pacmanTests/GameManagerTest.java

21
src/test/java/pacmanTests/GameManagerTest.java

@ -14,14 +14,10 @@ class GameManagerTest {
void GameManager_Update_increasesTime() {
// arrange
GameManager gameManager = new GameManager();
// act
int expectedUpdatedTime = gameManager.time + 1;
gameManager.Update();
int updatedTime = gameManager.time;
// assert
assertThat(expectedUpdatedTime).isEqualTo(updatedTime);
}
@ -29,53 +25,44 @@ class GameManagerTest {
@Test
void GameManager_Update_updatesVisualizer() {
// arrange
GameManager gameManager = new GameManager();
gameManager.visualizer = new VisualizerPlainTextUltra(gameManager);
VisualizerPlainTextUltra vptu = (VisualizerPlainTextUltra) gameManager.visualizer;
// act
String initialVptOutput = (String)vptu.GetOutput();
gameManager.Update();
String updatedVptOutput = (String)vptu.GetOutput();
// assert
assertThat(initialVptOutput).isNotEqualTo(updatedVptOutput);
}
@Test
void GameManager_GostPlayerColisionTest_DetectsColosion() {
// arrange
GameManager gameManager = new GameManager();
gameManager.player.position = gameManager.ghosts[0].position.Clone();
//act
boolean collision = gameManager.ghostPlayerColisionTest();
boolean expected = true;
// assert
assertThat(collision).isEqualTo(expected);
}
@Test
void GameManager_GostPlayerCollisionTest_DoesntDetectColliosion() {
// arrange
GameManager gameManager = new GameManager();
gameManager.player.position = new Vector2(2,3);
gameManager.ghosts[0].position = new Vector2(4,5);
//act
boolean collision = gameManager.ghostPlayerColisionTest();
boolean expected = false;
// assert
assertThat(collision).isEqualTo(expected);
}
@Test
void GameManager_setupgame_spawnsghosts() {
// arrange
GameManager gameManager = new GameManager();
gameManager.map.ghostSpawns[0] = new Vector2(1, 1);
@ -96,6 +83,7 @@ class GameManagerTest {
boolean expected = false;
assertThat(pause).isEqualTo(expected);
}
@Test
void GameManager_Pause_NotPause() {
GameManager gameManager = new GameManager();
@ -114,7 +102,6 @@ class GameManagerTest {
Cell fruitSpawn = gameManager.map.getCell(gameManager.map.playerSpawn);
String[] expected = {"cherry","strawberry","orange","apple","crystal"};
//act
gameManager.spawnFruit();
String result = fruitSpawn.type;
//assert

Loading…
Cancel
Save