@Test
  public void testRestoreExplicitlyTrashedParentPageWithRedirectPageFromTrash() throws Exception {

    WikiPage[] pages =
        WikiTestUtil.addRenamedTrashedParentPage(
            group.getGroupId(), _node.getNodeId(), false, true);

    WikiPage parentPage = pages[0];
    WikiPage childPage = pages[1];
    WikiPage redirectPage = pages[2];

    restoreTrashEntry(parentPage);

    parentPage = WikiPageLocalServiceUtil.getPageByPageId(parentPage.getPageId());
    childPage = WikiPageLocalServiceUtil.getPageByPageId(childPage.getPageId());
    redirectPage = WikiPageLocalServiceUtil.getPageByPageId(redirectPage.getPageId());

    Assert.assertFalse(parentPage.isInTrash());
    Assert.assertFalse(childPage.isInTrash());
    Assert.assertEquals(childPage.getParentTitle(), parentPage.getTitle());
    Assert.assertTrue(redirectPage.isInTrashExplicitly());
    Assert.assertEquals(redirectPage.getRedirectTitle(), parentPage.getTitle());

    restoreTrashEntry(redirectPage);
  }
  @Test
  public void testTrashVersionCreationWhenMovingToTrash() throws Exception {
    int initialTrashVersionsCount = TrashVersionLocalServiceUtil.getTrashVersionsCount();

    WikiTestUtil.addRenamedTrashedParentPage(group.getGroupId(), _node.getNodeId(), false, false);

    Assert.assertEquals(
        initialTrashVersionsCount + 3, TrashVersionLocalServiceUtil.getTrashVersionsCount());
  }
  @Test
  public void testTrashVersionDeletionWhenRestoringFromTrash() throws Exception {

    int initialTrashVersionCount = TrashVersionLocalServiceUtil.getTrashVersionsCount();

    WikiPage[] pages =
        WikiTestUtil.addRenamedTrashedParentPage(
            group.getGroupId(), _node.getNodeId(), false, false);

    WikiPage parentPage = pages[0];

    restoreTrashEntry(parentPage);

    Assert.assertEquals(
        initialTrashVersionCount, TrashVersionLocalServiceUtil.getTrashVersionsCount());
  }
  @Test
  public void testMoveParentPageWithRedirectPageToTrash() throws Exception {
    WikiPage[] pages =
        WikiTestUtil.addRenamedTrashedParentPage(
            group.getGroupId(), _node.getNodeId(), false, false);

    WikiPage parentPage = pages[0];
    WikiPage childPage = pages[1];
    WikiPage redirectPage = pages[2];

    Assert.assertTrue(parentPage.isInTrashExplicitly());
    Assert.assertTrue(childPage.isInTrashImplicitly());
    Assert.assertEquals(childPage.getParentTitle(), parentPage.getTitle());
    Assert.assertTrue(redirectPage.isInTrashImplicitly());
    Assert.assertEquals(redirectPage.getRedirectTitle(), parentPage.getTitle());
  }