### Question:
DefaultPageManager implements PageManager { @Override public PageProvider getProvider() { return m_provider; } DefaultPageManager(final Engine engine, final Properties props); @Override PageProvider getProvider(); @Override Collection< Page > getAllPages(); @Override String getPageText( final String pageName, final int version ); @Override String getPureText( final String page, final int version ); @Override String getText( final String page, final int version ); @Override void saveText( final Context context, final String text ); @Override void putPageText( final Page page, final String content ); @Override PageLock lockPage( final Page page, final String user ); @Override void unlockPage( final PageLock lock ); @Override PageLock getCurrentLock( final Page page ); @Override List< PageLock > getActiveLocks(); @Override Page getPage( final String pagereq ); @Override Page getPage( final String pagereq, final int version ); @Override Page getPageInfo( final String pageName, final int version); @Override @SuppressWarnings( "unchecked" ) List< T > getVersionHistory( final String pageName ); @Override String getCurrentProvider(); @Override String getProviderDescription(); @Override int getTotalPageCount(); @Override Set< Page > getRecentChanges(); @Override boolean pageExists( final String pageName ); @Override boolean pageExists( final String pageName, final int version ); @Override boolean wikiPageExists( final String page ); @Override boolean wikiPageExists( final String page, final int version ); @Override void deleteVersion( final Page page ); @Override void deletePage( final String pageName ); @Override void deletePage( final Page page ); @Override void actionPerformed( final WikiEvent event ); @Override PageSorter getPageSorter();  }### Answer:
@Test public void testPageCacheExists() throws Exception { engine.getWikiProperties().setProperty( "jspwiki.usePageCache", "true" ); final PageManager m = new DefaultPageManager( engine, engine.getWikiProperties() ); Assertions.assertTrue( m.getProvider() instanceof CachingProvider ); }
@Test public void testPageCacheNotInUse() throws Exception { engine.getWikiProperties().setProperty( "jspwiki.usePageCache", "false" ); final PageManager m = new DefaultPageManager( engine, engine.getWikiProperties() ); Assertions.assertFalse( m.getProvider() instanceof CachingProvider ); }
@Test public void testLatestGet3() throws Exception { final Properties props = engine.getWikiProperties(); props.setProperty( "jspwiki.pageProvider", "org.apache.wiki.providers.VerySimpleProvider" ); props.setProperty( "jspwiki.usePageCache", "false" ); final WikiEngine engine = new TestEngine( props ); final String p = engine.getManager( RenderingManager.class ).getHTML( "test", -1 ); final VerySimpleProvider vsp = (VerySimpleProvider) engine.getManager( PageManager.class ).getProvider(); Assertions.assertEquals( "test", vsp.m_latestReq, "wrong page" ); Assertions.assertEquals( 5, vsp.m_latestVers, "wrong version" ); Assertions.assertNotNull( p, "null" ); }
@Test public void testLatestGet4() throws Exception { final Properties props = engine.getWikiProperties(); props.setProperty( "jspwiki.pageProvider", "org.apache.wiki.providers.VerySimpleProvider" ); props.setProperty( "jspwiki.usePageCache", "true" ); final WikiEngine engine = new TestEngine( props ); final String p = engine.getManager( RenderingManager.class ).getHTML( VerySimpleProvider.PAGENAME, -1 ); final CachingProvider cp = (CachingProvider)engine.getManager( PageManager.class ).getProvider(); final VerySimpleProvider vsp = (VerySimpleProvider) cp.getRealProvider(); Assertions.assertEquals( VerySimpleProvider.PAGENAME, vsp.m_latestReq, "wrong page" ); Assertions.assertEquals( -1, vsp.m_latestVers, "wrong version" ); Assertions.assertNotNull( p, "null" ); }