POSCreditOrder extends Order { public void checkout() { paymentProcessor.chargeCard(paymentDetails, cart); super.checkout(); } POSCreditOrder(Cart cart, PaymentDetails paymentDetails, PaymentProcessor paymentProcessor); void checkout();  }
@Test public void checkoutOnlineOrder() { Order order = new POSCreditOrder(createCart(), createPaymentDetails(), setupPaymentProcessor()); order.checkout(); verify(paymentProcessor, times(1)).chargeCard(any(PaymentDetails.class), any(Cart.class)); }