DefaultWorldpayPaymentCheckoutFacade implements WorldpayPaymentCheckoutFacade { @Override public boolean hasBillingDetails() { final CartModel cartModel = getCart(); return cartModel != null && cartModel.getPaymentAddress() != null; } DefaultWorldpayPaymentCheckoutFacade(final CheckoutFacade checkoutFacade, final WorldpayCheckoutService worldpayCheckoutService, final CartService cartService, final CustomerAccountService customerAccountService); @Override void setBillingDetails(final AddressData addressData); @Override boolean hasBillingDetails();  }
@Test public void hasBillingDetailsReturnsFalseWhenCartIsNull() { when(cartServiceMock.getSessionCart()).thenReturn(null); final boolean result = testObj.hasBillingDetails(); assertFalse(result); }
@Test public void hasBillingDetailsReturnsFalseWhenPaymentAddressIsNull() { when(cartModelMock.getPaymentAddress()).thenReturn(null); final boolean result = testObj.hasBillingDetails(); assertFalse(result); }
@Test public void hasBillingDetailsReturnsTrueWhenCartModelAndPaymentAddressAreNotNull() { when(cartModelMock.getPaymentAddress()).thenReturn(paymentAddressMock); final boolean result = testObj.hasBillingDetails(); assertTrue(result); }