GraphsHandler { public TreeNode getModuleTree(final String moduleId) { final ModuleHandler moduleHandler = new ModuleHandler(repoHandler); final DbModule module = moduleHandler.getModule(moduleId); final TreeNode tree = new TreeNode(); tree.setName(module.getName()); for (final DbModule submodule : module.getSubmodules()) { addModuleToTree(submodule, tree); } return tree; } GraphsHandler(final RepositoryHandler repoHandler, final FiltersHolder filters); AbstractGraph getModuleGraph(final String moduleId); TreeNode getModuleTree(final String moduleId);  }
@Test public void getTreeOfModuleWithOneArtifactWithoutDependency(){ repoHandler.loadTestCase(new TC01_ModuleWithOneArtifactWithoutDependency()); final String moduleId = DbModule.generateID(TC01_ModuleWithOneArtifactWithoutDependency.MODULE_NAME, TC01_ModuleWithOneArtifactWithoutDependency.MODULE_VERSION); TreeNode tree = graphHandler.getModuleTree(moduleId); assertNotNull(tree); assertEquals(TC01_ModuleWithOneArtifactWithoutDependency.MODULE_NAME, tree.getName()); assertEquals(0, tree.getChildren().size()); }
@Test public void getTreeOfModuleWithOneSubmodule(){ repoHandler.loadTestCase(new TC03_ModuleWithOneSubmoduleAndDependencyOfEachType()); final String moduleId = DbModule.generateID(TC03_ModuleWithOneSubmoduleAndDependencyOfEachType.MODULE_NAME, TC03_ModuleWithOneSubmoduleAndDependencyOfEachType.MODULE_VERSION); TreeNode tree = graphHandler.getModuleTree(moduleId); assertNotNull(tree); assertEquals(1, tree.getChildren().size()); TreeNode subModule = tree.getChildren().get(0); assertEquals(TC03_ModuleWithOneSubmoduleAndDependencyOfEachType.SUBMODULE_NAME, subModule.getName()); assertEquals(0, subModule.getChildren().size()); }