### Question:
PageRenderer { public PageResourceProviderImpl getPageResourceProvider(final String pageName, final long tenantId) { return new PageResourceProviderImpl(pageName, tenantId); } PageRenderer(final ResourceRenderer resourceRenderer); void displayCustomPage(final HttpServletRequest request, final HttpServletResponse response, final APISession apiSession, final String pageName); void displayCustomPage(final HttpServletRequest request, final HttpServletResponse response, final APISession apiSession, final String pageName, final Locale currentLocale); void displayCustomPage(final HttpServletRequest request, final HttpServletResponse response, final APISession apiSession, final long pageId); void displayCustomPage(final HttpServletRequest request, final HttpServletResponse response, final APISession apiSession, final long pageId, final Locale currentLocale); void ensurePageFolderIsPresent(final APISession apiSession, final PageResourceProviderImpl pageResourceProvider); String getCurrentProfile(final HttpServletRequest request); Locale getCurrentLocale(final HttpServletRequest request); PageResourceProviderImpl getPageResourceProvider(final String pageName, final long tenantId); PageResourceProviderImpl getPageResourceProvider(final long pageId, final APISession apiSession); static final String PROFILE_PARAM; static final String LOCALE_PARAM; static final String DEFAULT_LOCALE; static final String LOCALE_COOKIE_NAME; }### Answer:
@Test public void should_get_pageResourceProvider_by_pageId() throws Exception { final String pageName = "pageName"; doReturn(pageName).when(page).getName(); doReturn(page).when(customPageService).getPage(apiSession, 42L); final PageResourceProviderImpl pageResourceProvider = pageRenderer.getPageResourceProvider(42L, apiSession); assertThat(pageResourceProvider.getPageName()).isEqualTo(pageName); }
@Test public void should_get_pageResourceProvider_by_pageName() throws Exception { final String pageName = "pageName"; doReturn(pageName).when(page).getName(); final PageResourceProviderImpl pageResourceProvider = pageRenderer.getPageResourceProvider(pageName,1L); assertThat(pageResourceProvider.getPageName()).isEqualTo(pageName); }