@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()); }
@Test public void testMoveExplicitlyParentPageAndChildPagePageWithChildToTrash() throws Exception { int initialBaseModelsCount = getNotInTrashBaseModelsCount(_node); int initialTrashEntriesCount = getTrashEntriesCount(group.getGroupId()); WikiPage[] pages = WikiTestUtil.addTrashedParentPageWithChildPageAndGrandchildPage( group.getGroupId(), _node.getNodeId(), false, true); WikiPage parentPage = pages[0]; WikiPage childPage = pages[1]; WikiPage grandchildPage = pages[2]; Assert.assertTrue(parentPage.isInTrashExplicitly()); Assert.assertTrue(childPage.isInTrashImplicitly()); Assert.assertEquals(parentPage.getTitle(), childPage.getParentTitle()); Assert.assertTrue(grandchildPage.isInTrashImplicitly()); Assert.assertEquals(childPage.getTitle(), grandchildPage.getParentTitle()); Assert.assertEquals(initialBaseModelsCount, getNotInTrashBaseModelsCount(_node)); Assert.assertEquals(initialTrashEntriesCount + 1, getTrashEntriesCount(group.getGroupId())); }