Java Reference
In-Depth Information
}
});
D
public void testFindAvailableRestaurants()
throws Exception {
findAvailableRestaurants(Calendar.TUESDAY, 19, 0,
RestaurantTestData.GOOD_ZIP_CODE, true);
}
E
public void testFindAvailableRestaurants_closedDay()
throws Exception {
findAvailableRestaurants(Calendar.MONDAY, 19, 0,
RestaurantTestData.GOOD_ZIP_CODE, false);
}
F
public void testFindAvailableRestaurants_badZipCode()
throws Exception {
findAvailableRestaurants(Calendar.MONDAY, 19, 0,
RestaurantTestData.BAD_ZIP_CODE, false);
}
}
Here's a closer look at JDORestaurantRepositoryQueryTests :
The setUp() method initializes the database by deleting existing restaurants and
inserting a test restaurant.
B
C
The findAvailableRestaurants() method, which is a helper method called by
the tests, executes the query with the parameters and verifies the result.
D
The testFindAvailableRestaurants_good() method executes the query with
delivery information that is served by a restaurant.
E
The testFindAvailableRestaurants_closedDay() method executes the
query with delivery information for a day that is not served by any restaurants.
F
The testFindAvailableRestaurants_badZipCode() method executes the
query with a ZIP code that is not served by any restaurants.
This class would also define tests for various boundary conditions such as a deliv-
ery time that is equal to the opening time of a restaurant and a delivery time that
is equal to its closing time.
Although these tests can be time consuming to write and execute, they are
extremely useful because they verify that the query behaves correctly.
Search WWH ::




Custom Search