Esempio n. 1
0
  @Test
  public void testRoom() throws Exception {
    // check default values
    Room r1 = new Room("test");
    assertEquals(r1.getNorth(), null);
    assertEquals(r1.getSouth(), null);
    assertEquals(r1.getEast(), null);
    assertEquals(r1.getWest(), null);

    // check if array list is empty
    assertTrue(r1.getItemsInRoom().isEmpty());
  }
Esempio n. 2
0
  @Test
  public void testSetLocation2() throws Exception {
    // create room in shape of '+' with five total
    // rooms ; one in center and one at each extremity
    Room base = new Room("test");
    Room up = new Room("test1");
    Room down = new Room("test2");
    Room left = new Room("test3");
    Room right = new Room("test4");

    // call method to set north = up, etc
    base.setLocation(up, down, left, right);

    // test if objects reference same memory location
    assertEquals(base.getNorth(), up);
    assertEquals(base.getSouth(), down);
    assertEquals(base.getEast(), left);
    assertEquals(base.getWest(), right);
  }