Java Reference
In-Depth Information
eq(deliveryTime))
.will(
returnValue(availableRestaurants));
D
mockPendingOrder.expects(once())
.method("setDeliveryAddress")
.with(eq(deliveryAddress));
mockPendingOrder.expects(once())
.method("setDeliveryTime")
.with(eq(deliveryTime));
mockPendingOrder
.expects(once())
.method("setState")
.with(eq(PendingOrder.
bbbbbb b DELIVERY_INFO_SPECIFIED));
E
UpdateDeliveryInfoResult result =
service
.updateDeliveryInfo(null,
deliveryAddress, deliveryTime);
F
assertEquals(
UpdateDeliveryInfoResult.
SELECT_RESTAURANT,
result.getStatusCode());
assertSame(pendingOrder, result
.getPendingOrder());
assertSame(availableRestaurants, result
.getAvailableResturants());
}
}
G
Let's look at the details:
B
The setup() method creates the mock objects and the PlaceOrderTransaction-
ScriptsImpl .
The testUpdateDeliveryInfo_good() method configures the mock PendingOrder-
DAO to expect its createPendingOrder() method to be called and to return the blank
PendingOrder .
The test configures the mock RestaurantDAO to expect its findAvailableRestau-
rants() to be called with the delivery information and to return the list of avail-
able restaurants.
C
D
E
The testUpdateDeliveryInfo_good() method configures the mock PendingOrder
to expect its savePendingOrder() to be called with the updated PendingOrder .
Search WWH ::




Custom Search