MBCommentManagerImpl implements CommentManager { @Override public int getCommentsCount(String className, long classPK) { return _mbMessageLocalService.getDiscussionMessagesCount( _portal.getClassNameId(className), classPK, WorkflowConstants.STATUS_APPROVED); }  @Override long addComment(
			long userId, long groupId, String className, long classPK,
			String body,
			Function<String, ServiceContext> serviceContextFunction); @Override long addComment(
			long userId, long groupId, String className, long classPK,
			String userName, String subject, String body,
			Function<String, ServiceContext> serviceContextFunction); @Override long addComment(
			long userId, String className, long classPK, String userName,
			long parentCommentId, String subject, String body,
			Function<String, ServiceContext> serviceContextFunction); @Override void addDiscussion(
			long userId, long groupId, String className, long classPK,
			String userName); @Override Discussion copyDiscussion(
			long userId, long groupId, String className, long classPK,
			long newClassPK,
			Function<String, ServiceContext> serviceContextFunction); @Override void deleteComment(long commentId); @Override void deleteDiscussion(String className, long classPK); @Override void deleteGroupComments(long groupId); @Override Comment fetchComment(long commentId); @Override DiscussionComment fetchDiscussionComment(long userId, long commentId); @Override List<Comment> getChildComments(
		long parentCommentId, int status, int start, int end); @Override int getChildCommentsCount(long parentCommentId, int status); @Override int getCommentsCount(String className, long classPK); @Override Discussion getDiscussion(
			long userId, long groupId, String className, long classPK,
			Function<String, ServiceContext> serviceContextFunction); @Override DiscussionPermission getDiscussionPermission(
		PermissionChecker permissionChecker); @Override DiscussionStagingHandler getDiscussionStagingHandler(); @Override List<Comment> getRootComments(
			String className, long classPK, int status, int start, int end); @Override int getRootCommentsCount(
		String className, long classPK, int status); @Override boolean hasDiscussion(String className, long classPK); @Override void moveDiscussionToTrash(String className, long classPK); @Override void restoreDiscussionFromTrash(String className, long classPK); @Override void subscribeDiscussion(
			long userId, long groupId, String className, long classPK); @Override void unsubscribeDiscussion(
			long userId, String className, long classPK); @Override long updateComment(
			long userId, String className, long classPK, long commentId,
			String subject, String body,
			Function<String, ServiceContext> serviceContextFunction);  }
@Test public void testGetCommentsCount() { long classPK = RandomTestUtil.randomLong(); long classNameId = RandomTestUtil.randomLong(); int commentsCount = RandomTestUtil.randomInt(); Mockito.when( _mbMessageLocalService.getDiscussionMessagesCount( classNameId, classPK, WorkflowConstants.STATUS_APPROVED) ).thenReturn( commentsCount ); Mockito.when( _portal.getClassNameId(_CLASS_NAME) ).thenReturn( classNameId ); Assert.assertEquals( commentsCount, _mbCommentManagerImpl.getCommentsCount(_CLASS_NAME, classPK)); }