MBUtil { public static String getMBMessageURL( long messageId, HttpServletRequest httpServletRequest) { ThemeDisplay themeDisplay = (ThemeDisplay)httpServletRequest.getAttribute( WebKeys.THEME_DISPLAY); PortletDisplay portletDisplay = themeDisplay.getPortletDisplay(); PortletURL portletURL = PortletURLFactoryUtil.create( httpServletRequest, portletDisplay.getId(), PortletRequest.RENDER_PHASE); portletURL.setParameter( "mvcRenderCommandName", "/message_boards/view_message"); portletURL.setParameter("messageId", String.valueOf(messageId)); return StringBundler.concat( portletURL.toString(), StringPool.POUND, portletDisplay.getNamespace(), "message_", messageId); }  static String getBBCodeQuoteBody(
		HttpServletRequest httpServletRequest, MBMessage parentMessage); static String getBBCodeSplitThreadBody(
		HttpServletRequest httpServletRequest); static long getCategoryId(
		HttpServletRequest httpServletRequest, MBCategory category); static long getCategoryId(
		HttpServletRequest httpServletRequest, MBMessage message); static String getEditorName(String messageFormat); static String getHtmlQuoteBody(
		HttpServletRequest httpServletRequest, MBMessage parentMessage); static String getHtmlSplitThreadBody(
		HttpServletRequest httpServletRequest); static String getMBMessageURL(
		long messageId, HttpServletRequest httpServletRequest); static String getMBMessageURL(
		long messageId, RenderResponse renderResponse); static String getMBMessageURL(
		long messageId, String layoutURL, RenderResponse renderResponse); static String[] getThreadPriority(
		MBGroupServiceSettings mbGroupServiceSettings, String languageId,
		double value); static boolean isViewableMessage(
			ThemeDisplay themeDisplay, MBMessage message); static boolean isViewableMessage(
			ThemeDisplay themeDisplay, MBMessage message,
			MBMessage parentMessage);  }
@Test public void testGetMBMessageURLIncludesMessageAnchor() { RenderResponse renderResponse = Mockito.mock(RenderResponse.class); Mockito.when( renderResponse.createRenderURL() ).thenReturn( Mockito.mock(PortletURL.class) ); String namespace = StringUtil.randomString(); Mockito.when( renderResponse.getNamespace() ).thenReturn( namespace ); long messageId = RandomTestUtil.randomInt(); Assert.assertTrue( StringUtil.endsWith( MBUtil.getMBMessageURL(messageId, renderResponse), StringBundler.concat( StringPool.POUND, namespace, "message_", messageId))); Assert.assertTrue( StringUtil.endsWith( MBUtil.getMBMessageURL( messageId, StringUtil.randomString(), renderResponse), StringBundler.concat( StringPool.POUND, namespace, "message_", messageId))); }