コード例 #1
0
 /**
  * Tests that incrementing the number of rooms by a specific amount will return the same amount
  * when getNumberOfRooms is called.
  */
 @Test
 public void testIncrementNumberOfRooms() {
   QuestHouse houseOfRooms = new QuestHouse();
   int numLoops = 5;
   for (int i = 0; i < numLoops; i++) {
     houseOfRooms.incrementNumberOfRooms();
   }
   assertEquals(
       numLoops,
       houseOfRooms
           .getNumberOfRooms()); // Asserts that the number of rooms returned matches the loop
                                 // amount
 }
コード例 #2
0
 /** Tests that a new QuestBuilding object will start with zero rooms. */
 @Test
 public void testZeroStartingRooms() {
   QuestHouse houseOfRooms = new QuestHouse();
   int numRooms = houseOfRooms.getNumberOfRooms();
   assertEquals(0, numRooms); // Asserts that the initial number of rooms is zero
 }