@Test
  public void testActivityHierarchy() throws Exception {
    AssetEntry parentAssetEntry = SocialActivityTestUtil.addAssetEntry(creatorUser, group);

    SocialActivityHierarchyEntryThreadLocal.push(
        parentAssetEntry.getClassNameId(), parentAssetEntry.getClassPK());

    SocialActivityTestUtil.addActivity(creatorUser, group, assetEntry, 1);

    List<SocialActivity> activities =
        SocialActivityLocalServiceUtil.getGroupActivities(
            group.getGroupId(), QueryUtil.ALL_POS, QueryUtil.ALL_POS);

    Assert.assertEquals(1, activities.size());

    SocialActivity activity = activities.get(0);

    Assert.assertEquals(parentAssetEntry.getClassNameId(), activity.getParentClassNameId());
    Assert.assertEquals(parentAssetEntry.getClassPK(), activity.getParentClassPK());

    SocialActivityTestUtil.addActivity(
        creatorUser, group, assetEntry, SocialActivityConstants.TYPE_DELETE);

    Assert.assertEquals(
        1, SocialActivityLocalServiceUtil.getGroupActivitiesCount(group.getGroupId()));
  }
  @Before
  public void setUp() throws Exception {
    group = GroupTestUtil.addGroup();

    actorUser = UserTestUtil.addUser("actor", group.getGroupId());
    creatorUser = UserTestUtil.addUser("creator", group.getGroupId());

    assetEntry = SocialActivityTestUtil.addAssetEntry(creatorUser, group, null);

    SocialActivityHierarchyEntryThreadLocal.clear();
  }