OnlineOrder extends Order { @Override public void checkout() { paymentProcessor.chargeCard(paymentDetails, cart); reservationService.reserveInventory(cart); notificationService.notifyCustomer(cart); super.checkout(); } OnlineOrder(Cart cart, PaymentDetails paymentDetails); @Override void checkout();  }
@Test(expected = OrderException.class) public void checkoutOnlineOrder() { Order order = new OnlineOrder(createCart(), createPaymentDetails()); order.checkout(); }