Java Reference
In-Depth Information
public void setUp() {
mockPlaceOrderService =
new Mock(PlaceOrderService.class);
mockResultFactory =
new Mock(PlaceOrderFacadeResultFactory.
b bbbbbbbb b class);
B Creates
mocks
placeOrderService =
(PlaceOrderService)
mockPlaceOrderService.proxy();
resultFactory =
(PlaceOrderFacadeResultFactory)
mockResultFactory.proxy();
placeOrderFacade =
new PlaceOrderFacadeImpl(
placeOrderService,
resultFactory);
}
C Creates
façade
public void testUpdateRestaurant() throws Exception {
String restaurantId = "restaurantId";
PlaceOrderServiceResult
placeOrderServiceResult
= new PlaceOrderServiceResult(
PlaceOrderStatusCodes.OK,
pendingOrder);
D Creates objects
returned by mocks
PlaceOrderFacadeResult
resultFactoryResult
= new PlaceOrderFacadeResult(
PlaceOrderStatusCodes.OK,
pendingOrder,
availableRestaurants);
mockPlaceOrderService
.expects(once())
.method("updateRestaurant")
.with(eq(pendingOrderId),
eq(restaurantId))
.will(returnValue(
bbbbbbb b placeOrderServiceResult));
mockResultFactory
.expects(once())
.method("make")
E Defines expectations
for mocks
Search WWH ::




Custom Search