/** Tests the die method for te player when it has only one live left. */ @Test @SuppressWarnings("checkstyle:magicnumber") public final void testDieOutOfLives() { game.start(); player.die(); player.die(); player.die(); Assert.assertFalse(game.isInProgress()); }
/** Tests the respawn method to load the spaceship in the middle again. */ @Test @SuppressWarnings("checkstyle:magicnumber") public final void testRespawn() { player.getSpaceShip().setVelX(20); player.getSpaceShip().move(60.0); player.respawnShip(); Assert.assertEquals(game.getCanvasWidth() / 2, player.getSpaceShip().getXCoor(), 0.05); }
/** Setup the player class for testing. */ @Before @SuppressWarnings("checkstyle:magicnumber") public final void setUp() { game = new SinglePlayerGame(200, 200); player = new Player(game, game.getCanvasWidth() / 2); }