DefaultWorldpayUrlService extends AbstractWorldpayUrlService { protected String getFullUrl(final String url, final boolean isSecure) throws WorldpayConfigurationException { final BaseSiteModel currentBaseSite = getBaseSiteService().getCurrentBaseSite(); final String fullResponseUrl = siteBaseUrlResolutionService.getWebsiteUrlForSite(currentBaseSite, isSecure, url); if (fullResponseUrl == null) { throw new WorldpayConfigurationException("The URL returned from the SiteBaseUrlResolutionService is null. Please check the configuration of the HOP URL's"); } return fullResponseUrl; }  @Override String getWebsiteUrlForCurrentSite(); @Override String getFullSuccessURL(); @Override String getFullPendingURL(); @Override String getFullFailureURL(); @Override String getFullCancelURL(); @Override String getFullErrorURL(); @Override String getFullThreeDSecureTermURL(); @Override String getFullThreeDSecureQuoteTermURL(); @Override String getFullTermsUrl(); @Override String getBaseWebsiteUrlForSite(); @Override String getKlarnaConfirmationURL(); @Override String getFullThreeDSecureFlexFlowReturnUrl(); @Override String getFullThreeDSecureFlexAutosubmitUrl(); BaseSiteService getBaseSiteService(); @Required void setBaseSiteService(final BaseSiteService baseSiteService); @Required void setSiteBaseUrlResolutionService(final SiteBaseUrlResolutionService siteBaseUrlResolutionService);  }
@Test public void testGetFullUrlSecure() throws Exception { when(baseSiteServiceMock.getCurrentBaseSite()).thenReturn(currentBaseSiteMock); when(siteBaseUrlResolutionServiceMock.getWebsiteUrlForSite(currentBaseSiteMock, true, URL)).thenReturn(FULL_SITE_URL); final String result = testObj.getFullUrl(URL, true); assertEquals(FULL_SITE_URL, result); }
@Test public void testGetFullUrlUnSecure() throws Exception { when(baseSiteServiceMock.getCurrentBaseSite()).thenReturn(currentBaseSiteMock); when(siteBaseUrlResolutionServiceMock.getWebsiteUrlForSite(currentBaseSiteMock, false, URL)).thenReturn(FULL_SITE_URL); final String result = testObj.getFullUrl(URL, false); assertEquals(FULL_SITE_URL, result); }
@Test(expected = WorldpayConfigurationException.class) public void testGetFullUrlShouldRaiseExceptionWhenServiceReturnsNull() throws Exception { when(baseSiteServiceMock.getCurrentBaseSite()).thenReturn(currentBaseSiteMock); when(siteBaseUrlResolutionServiceMock.getWebsiteUrlForSite(currentBaseSiteMock, true, URL)).thenReturn(null); testObj.getFullUrl(URL, true); }