Functions { public static String getPageHtml(String projectName, String branchName, String path) throws IOException { Authentication authentication = SecurityContextHolder.getContext().getAuthentication(); Locale locale = LocaleContextHolder.getLocale(); HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest(); String contextPath = request.getContextPath(); String html = pageRenderer.getHtml(projectName, branchName, path, authentication, locale, contextPath); return markdownProcessor.processNonCacheableMacros(html, projectName, branchName, path, authentication, locale, contextPath); }  @PostConstruct void init(); static List<String> listProjects(); static List<String> listProjectBranches(String projectName); static List<String> listPageAttachments(String projectName, String branchName, String path); static String getPageTitle(String projectName, String branchName, String path); static List<String> getBranchesPageIsSharedWith(String projectName, String branchName, String path); static List<String> listUsers(); static String getPageHtml(String projectName, String branchName, String path); static String getPageHeaderHtml(String projectName, String branchName, String path); static List<String> getPagePathHierarchy(String projectName, String branchName, String pagePath); static PageMetadata getPageMetadata(String projectName, String branchName, String path); static PageMetadata getAttachmentMetadata(String projectName, String branchName, String pagePath,
			String name); static List<String> listRoles(); static List<RoleGrantedAuthority> getUserAuthorities(String loginName); static String formatSize(long size); static List<PageVersion> listPageVersions(String projectName, String branchName, String path); static List<OpenId> listMyOpenIds(); static List<JspMacroDescriptor> getMacros(); static int floor(double d); static String getLanguage(); static String escapeJavaScript(String s); static boolean pageExists(String projectName, String branchName, String path); static boolean isSubscribed(String projectName, String branchName, String path); static String getSystemSetting(String key); static String getLatestVersionForUpdate(); static List<String> getGroovyMacros(); static String substringBeforeLast(String s, String separator);  }
@Test public void getPageHtml() throws IOException { when(pageRenderer.getHtml(PROJECT, BRANCH, PAGE, authentication, Locale.US, CONTEXT)).thenReturn("html"); when(markdownProcessor.processNonCacheableMacros("html", PROJECT, BRANCH, PAGE, authentication, Locale.US, CONTEXT)).thenReturn("htmlWithMacros"); when(request.getContextPath()).thenReturn(CONTEXT); assertEquals("htmlWithMacros", Functions.getPageHtml(PROJECT, BRANCH, PAGE)); }