MediaDaoImpl implements MediaDao { @Override public void cleanUpCache() { mediaIndexDao.clean(); } @Inject  MediaDaoImpl(final ConfigurationManager configurationManager, final MimeTypeManager mimeTypeManager, final MediaIndexDao mediaIndexDao); @Override Optional<MediaNode> getNode(final String nodeId); @Override List<MediaNode> getChildNodes(final String parentNodeId); @Override List<MediaNode> getRootNodeChildren(final RootNode rootNode); @Override void cleanUpCache();  }
@Test public void testCleanupCache() { ConfigurationManager configurationManager = new ConfigurationManagerImpl(new TestConfigurationDao()); MimeTypeManager mimeTypeManager = createMock(MimeTypeManager.class); MediaIndexDao mediaIndexDao = createMock(MediaIndexDao.class); mediaIndexDao.clean(); expectLastCall(); replay(mimeTypeManager, mediaIndexDao); MediaDaoImpl mediaDao = new MediaDaoImpl(configurationManager, mimeTypeManager, mediaIndexDao); mediaDao.cleanUpCache(); verify(mimeTypeManager, mediaIndexDao); }