Java Reference
In-Depth Information
Calls
updateDeliveryInfo()
goodDeliveryAddress,
goodDeliveryTime));
assertTrue(result);
assertSame(
goodDeliveryAddress,
pendingOrder.getDeliveryAddress());
assertSame(
goodDeliveryTime,
pendingOrder.getDeliveryTime());
Verifies
the outcome
}
}
The test case configures the mock RestaurantRepository to expect its isRestau-
rantAvailable() method to be called and return true . It verifies that Pending-
Order.updateDeliveryInfo() stores the delivery information stored in Pending-
Order and returns true .
3.3.3
Summary of the design
So far we have only scratched the surface of the design, but by taking the enter pay-
ment information request, writing a couple of tests, and implementing some meth-
ods, we have already started to flesh out the domain model for the Place Order
use case.
As figure 3.4 shows, we have partially implemented and tested several classes
and methods. We have written the PlaceOrderService.updateDeliveryInfo() and
PendingOrder.updateDeliveryInfo() methods. We have also identified some
repository methods: PendingOrderRepository.findOrCreatePendingOrder() , Res-
taurantRepository.isRestaurantAvailable() , and RestaurantRepository.find-
AvailableRestaurants() .
Of course, there is a lot more work to do. For example, we need to write some
more tests for PlaceOrderService.updateDeliveryInfo() and PendingOrder.up-
dateDeliveryInfo() , including ones that call those methods with invalid delivery
information. There are also all the other requests to implement. After each mini-
cycle of test writing and implementation, we move closer and closer to the domain
model shown at the beginning of this chapter. To see the complete domain model,
visit the topic's website.
 
 
 
 
Search WWH ::




Custom Search