Browse Source

added test for Cell

remotes/origin/player
fdai7910 11 months ago
parent
commit
e4a90e9da5
  1. 26
      src/test/java/pacmanTests/CellTest.java

26
src/test/java/pacmanTests/CellTest.java

@ -0,0 +1,26 @@
package pacmanTests;
import static org.assertj.core.api.Assertions.assertThat;
import static org.junit.jupiter.api.Assertions.*;
import org.junit.jupiter.api.Test;
import pacmanGame.*;
class CellTest {
@Test
void cell_triggerItem_505cherryScore() {
// arrange
GameManager gameManager = new GameManager();
Cell cell = gameManager.map.GetCell(new Vector2(0,0));
cell.type = "cherry";
int expectedScore = 505;
// act
cell.triggerItem();
int resultingScore = gameManager.score;
// assert
assertThat(expectedScore).isEqualTo(resultingScore);
}
}
Loading…
Cancel
Save