AbstractWorldpayOrderService { public CommerceCheckoutParameter createCommerceCheckoutParameter(final AbstractOrderModel abstractOrderModel, final PaymentInfoModel paymentInfoModel, final BigDecimal authorisationAmount) { final CommerceCheckoutParameter parameter = new CommerceCheckoutParameter(); parameter.setEnableHooks(true); if (abstractOrderModel instanceof CartModel) { parameter.setCart((CartModel) abstractOrderModel); } else { parameter.setOrder(abstractOrderModel); } parameter.setPaymentInfo(paymentInfoModel); parameter.setAuthorizationAmount(authorisationAmount); parameter.setPaymentProvider(commerceCheckoutService.getPaymentProvider()); return parameter; } protected  AbstractWorldpayOrderService(final CommerceCheckoutService commerceCheckoutService,
                                           final WorldpayPaymentInfoService worldpayPaymentInfoService,
                                           final WorldpayPaymentTransactionService worldpayPaymentTransactionService,
                                           final WorldpayOrderService worldpayOrderService,
                                           final WorldpayServiceGateway worldpayServiceGateway,
                                           final AddressService addressService); CommerceCheckoutParameter createCommerceCheckoutParameter(final AbstractOrderModel abstractOrderModel, final PaymentInfoModel paymentInfoModel, final BigDecimal authorisationAmount); AddressModel cloneAndSetBillingAddressFromCart(final CartModel cartModel, final PaymentInfoModel paymentInfoModel); CommerceCheckoutService getCommerceCheckoutService(); WorldpayPaymentInfoService getWorldpayPaymentInfoService(); WorldpayPaymentTransactionService getWorldpayPaymentTransactionService(); WorldpayOrderService getWorldpayOrderService(); WorldpayServiceGateway getWorldpayServiceGateway();  }
@Test public void createCommerceCheckoutParameter_shouldCreateCommerceCheckoutParameter_WhenItIsCalled() { when(commerceCheckoutServiceMock.getPaymentProvider()).thenReturn(PAYMENT_PROVIDER); final CommerceCheckoutParameter result = testObj.createCommerceCheckoutParameter(cartModelMock, paymentInfoModelMock, BigDecimal.ONE); assertEquals(paymentInfoModelMock, result.getPaymentInfo()); assertTrue(result.isEnableHooks()); assertEquals(BigDecimal.ONE, result.getAuthorizationAmount()); assertEquals(PAYMENT_PROVIDER, result.getPaymentProvider()); assertEquals(cartModelMock, result.getCart()); }