@Override
  protected void addActivities() throws Exception {
    message = MBTestUtil.addMessage(group.getGroupId());

    message =
        MBTestUtil.addMessage(
            group.getGroupId(),
            message.getCategoryId(),
            message.getThreadId(),
            message.getMessageId());
  }
  @Override
  protected void addAttachment(ClassedModel classedModel) throws Exception {
    MBMessage message = (MBMessage) classedModel;

    List<FileEntry> fileEntries = message.getAttachmentsFileEntries();

    List<String> existingFiles = new ArrayList<>();

    for (FileEntry fileEntry : fileEntries) {
      existingFiles.add(fileEntry.getTitle());
    }

    ServiceContext serviceContext = ServiceContextTestUtil.getServiceContext(message.getGroupId());

    List<ObjectValuePair<String, InputStream>> inputStreamOVPs =
        MBTestUtil.getInputStreamOVPs("OSX_Test.docx", getClass(), getSearchKeywords());

    MBMessageLocalServiceUtil.updateMessage(
        TestPropsValues.getUserId(),
        message.getMessageId(),
        getSearchKeywords(),
        getSearchKeywords(),
        inputStreamOVPs,
        existingFiles,
        0,
        false,
        serviceContext);
  }
  @Override
  protected BaseModel<?> updateBaseModel(
      BaseModel<?> baseModel, String keywords, ServiceContext serviceContext) throws Exception {

    MBMessage message = (MBMessage) baseModel;

    message.setSubject(keywords);
    message.setBody(keywords);

    return MBTestUtil.updateMessage(message, keywords, keywords, true);
  }
  @Test
  public void testGetNoAssetThreads() throws Exception {
    MBTestUtil.addMessage(_group.getGroupId());

    MBMessage message = MBTestUtil.addMessage(_group.getGroupId());

    MBThread thread = message.getThread();

    AssetEntry assetEntry =
        AssetEntryLocalServiceUtil.fetchEntry(MBThread.class.getName(), thread.getThreadId());

    Assert.assertNotNull(assetEntry);

    AssetEntryLocalServiceUtil.deleteAssetEntry(assetEntry);

    List<MBThread> threads = MBThreadLocalServiceUtil.getNoAssetThreads();

    Assert.assertEquals(1, threads.size());
    Assert.assertEquals(thread, threads.get(0));
  }
  @Override
  protected BaseModel<?> addBaseModelWithWorkflow(
      BaseModel<?> parentBaseModel,
      boolean approved,
      String keywords,
      ServiceContext serviceContext)
      throws Exception {

    MBCategory category = (MBCategory) parentBaseModel;

    return MBTestUtil.addMessage(
        category.getGroupId(), category.getCategoryId(), keywords, approved, serviceContext);
  }
  @Override
  protected void updateBaseModel(long userId, long baseModelId) throws Exception {

    MBMessage message = MBMessageLocalServiceUtil.getMessage(baseModelId);

    ServiceContext serviceContext =
        ServiceContextTestUtil.getServiceContext(message.getGroupId(), userId);

    MBTestUtil.populateNotificationsServiceContext(serviceContext, Constants.UPDATE);

    MBMessageLocalServiceUtil.updateMessage(
        userId, message.getMessageId(), RandomTestUtil.randomString(), serviceContext);
  }
  @Override
  protected long addContainerModel(long userId, long containerModelId) throws Exception {

    ServiceContext serviceContext =
        ServiceContextTestUtil.getServiceContext(group.getGroupId(), userId);

    MBTestUtil.populateNotificationsServiceContext(serviceContext, Constants.ADD);

    MBCategory category =
        MBCategoryLocalServiceUtil.addCategory(
            userId,
            containerModelId,
            RandomTestUtil.randomString(),
            StringPool.BLANK,
            serviceContext);

    return category.getCategoryId();
  }
  @Override
  protected long addBaseModel(long userId, long containerModelId) throws Exception {

    ServiceContext serviceContext =
        ServiceContextTestUtil.getServiceContext(group.getGroupId(), userId);

    MBTestUtil.populateNotificationsServiceContext(serviceContext, Constants.ADD);

    MBMessage message =
        MBMessageLocalServiceUtil.addMessage(
            userId,
            RandomTestUtil.randomString(),
            group.getGroupId(),
            containerModelId,
            RandomTestUtil.randomString(),
            RandomTestUtil.randomString(),
            serviceContext);

    return message.getMessageId();
  }
  protected MBMessage addMBMessageAttachment() throws Exception {
    List<ObjectValuePair<String, InputStream>> objectValuePairs =
        MBTestUtil.getInputStreamOVPs("OSX_Test.docx", getClass(), StringPool.BLANK);

    ServiceContext serviceContext = ServiceContextTestUtil.getServiceContext(_group.getGroupId());

    User user = TestPropsValues.getUser();

    return MBMessageLocalServiceUtil.addMessage(
        user.getUserId(),
        user.getFullName(),
        _group.getGroupId(),
        MBCategoryConstants.DEFAULT_PARENT_CATEGORY_ID,
        "Subject",
        "Body",
        MBMessageConstants.DEFAULT_FORMAT,
        objectValuePairs,
        false,
        0,
        false,
        serviceContext);
  }
  @Override
  protected BaseModel<?> getParentBaseModel(Group group, ServiceContext serviceContext)
      throws Exception {

    return MBTestUtil.addCategory(serviceContext);
  }