MediaManagerImpl implements MediaManager { @Override public void cleanUpCache() { mediaDao.cleanUpCache(); } @Inject  MediaManagerImpl(final ConfigurationManager configurationManager, final ResourceBundle resourceBundle, final MediaDao mediaDao,
                            final MimeTypeManager mimeTypeManager, @Named("localAddress") final InetAddress localAddress); @Override Optional<MediaNode> getNode(final String nodeId); @Override String getNodeUrl(final MediaNode node); @Override Collection<MediaNode> searchChildNodes(final MediaSearchRequest request); @Override void cleanUpCache(); @Subscribe void handleMediaEvent(final MediaEvent mediaEvent);  }
@Test public void testCleanupCache() { ConfigurationManager configurationManager = new ConfigurationManagerImpl(new TestConfigurationDao()); ResourceBundle resourceBundle = ResourceBundle.getBundle("message"); MediaDao mediaDao = createMock(MediaDao.class); MimeTypeManager mimeTypeManager = createMock(MimeTypeManager.class); InetAddress localAddress = createMock(InetAddress.class); mediaDao.cleanUpCache(); expectLastCall(); replay(mediaDao, mimeTypeManager, localAddress); MediaManagerImpl mediaManager = new MediaManagerImpl(configurationManager, resourceBundle, mediaDao, mimeTypeManager, localAddress); mediaManager.cleanUpCache(); verify(mediaDao, mimeTypeManager, localAddress); }