Class DomainTest

java.lang.Object
nz.ac.vuw.ecs.swen225.gp22.domain.DomainTest

public class DomainTest extends Object
Tests to check the integrity of the game state in the domain module.

These tests cover everything except for the DevMarkers class, which is used for testing and marking work in progress code.

Author:
Abdul
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Checks that the player moves 2 tiles if they step on a bounce pad.
    void
    Checks that created tiles have the expected properties.
    void
    Checks that all tiles can be added properly.
    void
    Checks that the enemy can kill the player and move properly.
    void
    Checks that the player can walk onto the exit.
    void
    Checks that the correct ID is given when using the getID() methods.
    void
    Checks that the tile factory method will throw an IllegalArgumentException when the incorrect parameter types are given.
    void
    Checks that the player can correctly pickup a key.
    void
    Checks that the player can move properly.
    void
    Checks that a new maze is created properly.
    void
    Makes sure the Direction enum has the correct opposite directions
    void
    Checks that the player loses the game if they step on a milk tile.
    void
    Making sure equals() and hashCode() in Maze.Point is reflexive, transitive, and symmetric.
    void
    Checks that an action can be redone properly.
    void
    Checks that the tile factory method can correctly create tiles based on the ID.
    void
    Checks that all actions undo properly.
    void
    Checks that the player can correctly unlock a door only when the player has the correct key, and that the key is consumed.
    void
    Checks that the player can correctly pickup a treasure, and unlock a locked exit when the player has all the treasures.
    void
    Checks that the tile factory method will throw an IllegalStateException if the constructor of a class throws an error.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • DomainTest

      public DomainTest()
  • Method Details

    • newMazeTest

      @Test public void newMazeTest()
      Checks that a new maze is created properly.
    • createTilesTest

      @Test public void createTilesTest()
      Checks that all tiles can be added properly.
    • movePlayerTest

      @Test public void movePlayerTest()
      Checks that the player can move properly.
    • correctTileInfoTest

      @Test public void correctTileInfoTest()
      Checks that created tiles have the expected properties.
    • keyPickupTest

      @Test public void keyPickupTest()
      Checks that the player can correctly pickup a key.
    • unlockDoorTest

      @Test public void unlockDoorTest()
      Checks that the player can correctly unlock a door only when the player has the correct key, and that the key is consumed.
    • unlockExitTest

      @Test public void unlockExitTest()
      Checks that the player can correctly pickup a treasure, and unlock a locked exit when the player has all the treasures.
    • bouncePadTest

      @Test public void bouncePadTest()
      Checks that the player moves 2 tiles if they step on a bounce pad. Also checks that a deletedtile will not still move the player.
    • enemyTest

      @Test public void enemyTest()
      Checks that the enemy can kill the player and move properly.
    • playerDeathTest

      @Test public void playerDeathTest()
      Checks that the player loses the game if they step on a milk tile. Also checks that a deleted milk tile will not still kill the player.
    • exitLevelTest

      @Test public void exitLevelTest()
      Checks that the player can walk onto the exit.
    • undoTest

      @Test public void undoTest()
      Checks that all actions undo properly.
    • redoTest

      @Test public void redoTest()
      Checks that an action can be redone properly.
    • oppositeDirectionsTest

      @Test public void oppositeDirectionsTest()
      Makes sure the Direction enum has the correct opposite directions
    • successfulFactoryTest

      @Test public void successfulFactoryTest()
      Checks that the tile factory method can correctly create tiles based on the ID.
    • incorrectParametersTest

      @Test public void incorrectParametersTest()
      Checks that the tile factory method will throw an IllegalArgumentException when the incorrect parameter types are given.
    • unsuccessfulFactoryTest

      @Test public void unsuccessfulFactoryTest()
      Checks that the tile factory method will throw an IllegalStateException if the constructor of a class throws an error. In this case it is done by providing a point outside of the tileMap bounds.
    • getIDTest

      @Test public void getIDTest()
      Checks that the correct ID is given when using the getID() methods.
    • pointTest

      @Test public void pointTest()
      Making sure equals() and hashCode() in Maze.Point is reflexive, transitive, and symmetric.