Java Reference
In-Depth Information
else
assertTrue(availableRestaurants.isEmpty());
}
public void
testFindAvailableRestaurants_good()
throws Exception {
findAvailableRestaurants(Calendar.TUESDAY,
RestaurantMother.GOOD_HOUR, 0, GOOD_ZIP_CODE, true);
}
D Tests with good
delivery info
public void
testFindAvailableRestaurants_badZipCode()
throws Exception {
findAvailableRestaurants(Calendar.TUESDAY,
RestaurantMother.GOOD_HOUR, 0, BAD_ZIP_CODE, false);
}
}
E Tests with bad
delivery info
Let's examine HibernateRestaurantRepositoryQueryTests :
The setUp() method initializes the database by deleting existing restaurants and
inserting a restaurant that serves the 94619 ZIP code.
B
C
findAvailableRestaurants() , which is a helper method called by the tests, exe-
cutes the query with the parameters and verifies the result.
D
testFindAvailableRestaurants_good() executes the query with delivery informa-
tion that is served by a restaurant.
E
testFindAvailableRestaurants_badZipCode() 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.
Although these tests can be time consuming to write and execute, they verify
that the query behaves correctly and are thus extremely useful.
6.5 Hibernate performance tuning
Chapter 4 described how eager loading and process-level caching can be used to
significantly improve performance. You can determine which relationships to
eagerly load by analyzing the application and then identify the relationships that
are traversed when handling each request. If the application always traverses a
 
 
 
Search WWH ::




Custom Search