AbstractWorldpayDirectCheckoutStepController extends WorldpayChoosePaymentMethodCheckoutStepController { public void setDDCIframeData(final Model model) { final String ddcUrl = Optional.ofNullable(getWorldpayMerchantConfigDataFacade().getCurrentSiteMerchantConfigData()) .map(WorldpayMerchantConfigData::getThreeDSFlexJsonWebTokenSettings) .map(ThreeDSFlexJsonWebTokenCredentials::getDdcUrl) .orElse(null); model.addAttribute(THREEDSECURE_FLEX_DDC_URL, ddcUrl); model.addAttribute(THREEDSECURE_JWT_FLEX_DDC, worldpayDDCFacade.createJsonWebTokenForDDC()); }  String handleDirectResponse(final Model model, final DirectResponseData directResponseData, final HttpServletResponse response); void setDDCIframeData(final Model model);  }
@Test public void setDDCIframeData_shouldPopulate3DSecureJsonWebToken_AndDDCURLValue() { when(worldpayDDCFacadeMock.createJsonWebTokenForDDC()).thenReturn(THREEDSFLEX_JSON_WEB_TOKEN_VALUE); when(worldpayMerchantConfigDataMock.getThreeDSFlexJsonWebTokenSettings().getDdcUrl()).thenReturn(THREEDSECURE_FLEX_DDC_URL_VALUE); testObj.setDDCIframeData(modelMock); verify(modelMock).addAttribute(THREEDSECURE_JWT_FLEX_DDC, THREEDSFLEX_JSON_WEB_TOKEN_VALUE); verify(modelMock).addAttribute(THREEDSECURE_FLEX_DDC_URL, THREEDSECURE_FLEX_DDC_URL_VALUE); }