@Test
public void clear() throws Exception {

  try {
    PowerMockito.mockStatic( DataCacheFactory.class );
    final DataCache dataCache = mock( DataCache.class );
    when( DataCacheFactory.getCache() ).thenReturn( dataCache );
    final DataCacheManager dataCacheManager = mock( DataCacheManager.class );
    when( dataCache.getCacheManager() ).thenReturn( dataCacheManager );
    final IPluginCacheManager cacheManager = mock( IPluginCacheManager.class );
    final IReportContentCache contentCache = mock( IReportContentCache.class );
    when( cacheManager.getCache() ).thenReturn( contentCache );
    PentahoSystem.registerObject( cacheManager, IPluginCacheManager.class );
    final ICacheManager iCacheManager = mock( ICacheManager.class );
    PentahoSystem.registerObject( iCacheManager, ICacheManager.class );
    final Response clear = new CacheManagerEndpoint().clear();
    assertEquals( 200, clear.getStatus() );
    verify( contentCache, times( 1 ) ).cleanupCurrentSession();
    verify( iCacheManager, times( 1 ) ).clearRegionCache( "report-output-handlers" );
    verify( dataCacheManager, times( 1 ) ).clearAll();
  } finally {
    PentahoSystem.shutdown();
  }
}