MBUtil { public static long getCategoryId( HttpServletRequest httpServletRequest, MBCategory category) { long categoryId = MBCategoryConstants.DEFAULT_PARENT_CATEGORY_ID; if (category != null) { categoryId = category.getCategoryId(); } return ParamUtil.getLong( httpServletRequest, "mbCategoryId", categoryId); }  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 testGetCategoryIdReturnsCategoryId() { long categoryId = RandomTestUtil.randomInt(); MBCategory category = Mockito.mock(MBCategory.class); Mockito.when( category.getCategoryId() ).thenReturn( categoryId ); Assert.assertEquals( categoryId, MBUtil.getCategoryId( Mockito.mock(HttpServletRequest.class), category)); }
@Test public void testGetCategoryIdReturnsRequestValue() { long categoryId = RandomTestUtil.randomInt(); HttpServletRequest httpServletRequest = Mockito.mock( HttpServletRequest.class); Mockito.when( httpServletRequest.getParameter("mbCategoryId") ).thenReturn( String.valueOf(categoryId) ); Assert.assertEquals( categoryId, MBUtil.getCategoryId(httpServletRequest, (MBCategory)null)); }
@Test public void testGetMBMessageCategoryIdReturnsMessageCategoryId() { long categoryId = RandomTestUtil.randomInt(); MBMessage message = Mockito.mock(MBMessage.class); Mockito.when( message.getCategoryId() ).thenReturn( categoryId ); Assert.assertEquals( categoryId, MBUtil.getCategoryId( Mockito.mock(HttpServletRequest.class), message)); }
@Test public void testGetMBMessageCategoryIdReturnsRequestValue() { long categoryId = RandomTestUtil.randomInt(); HttpServletRequest httpServletRequest = Mockito.mock( HttpServletRequest.class); Mockito.when( httpServletRequest.getParameter("mbCategoryId") ).thenReturn( String.valueOf(categoryId) ); Assert.assertEquals( categoryId, MBUtil.getCategoryId(httpServletRequest, (MBMessage)null)); }