MediaDaoImpl implements MediaDao { @Override public List<MediaNode> getRootNodeChildren(final RootNode rootNode) { List<ConfigurationNode> configNodes = configurationManager.getNodes(rootNode); List<MediaNode> nodes = new ArrayList<>(configNodes.size()); for (ConfigurationNode configNode : configNodes) { mediaIndexDao.put(configNode.getId(), buildConfigMediaIndexElement(rootNode, configNode)); nodes.add(new FolderNode(configNode.getId(), rootNode.getId(), configNode.getLabel(), new File(configNode.getPath()))); } return nodes; } @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 testGetRootNodeChildrenNodesOfVideo() { ConfigurationManager configurationManager = new ConfigurationManagerImpl(new TestConfigurationDao()); MimeTypeManager mimeTypeManager = createMock(MimeTypeManager.class); MediaIndexDao mediaIndexDao = createMock(MediaIndexDao.class); mediaIndexDao.put(isA(String.class), isA(MediaIndexElement.class)); expectLastCall().atLeastOnce(); replay(mimeTypeManager, mediaIndexDao); MediaDaoImpl mediaDao = new MediaDaoImpl(configurationManager, mimeTypeManager, mediaIndexDao); List<MediaNode> result = mediaDao.getRootNodeChildren(VIDEO); assertNotNull(result); verify(mimeTypeManager, mediaIndexDao); }