DataUtils { public static Set<Dependency> getAllDependencies(final Module module) { final Set<Dependency> dependencies = new HashSet<Dependency>(); dependencies.addAll(module.getDependencies()); for(final Module submodule: module.getSubmodules()){ dependencies.addAll(getAllDependencies(submodule)); } return dependencies; } private  DataUtils(); static List<String> getAllArtifacts(final DbModule module); static Set<Artifact> getAllArtifacts(final Module module); static Set<Dependency> getAllDependencies(final Module module); static List<DbDependency> getAllDbDependencies(final DbModule module); static String getModuleName(final String moduleId); static String getModuleVersion(final String moduleId); static String getGroupId(final String gavc); static DbArtifact createDbArtifact(final String gavc); static Artifact createArtifact(final String gavc); static List<DbModule> getAllSubmodules(final DbModule module); static boolean isFullGAVC(final String entry); static String strip(final String gavc, final int stripCount); static void sort(final List<Artifact> targets);  }
@Test public void getAllDependencies(){ final Module module = DataModelFactory.createModule("root", "1"); module.addDependency(DataModelFactory.createDependency(DataModelFactory.createArtifact("gr1", "art1", "123", "", "", ""), Scope.SYSTEM)); final Module submodule1 = DataModelFactory.createModule("sub1", "1"); submodule1.addDependency(DataModelFactory.createDependency(DataModelFactory.createArtifact("gr2", "art2", "123", "", "", ""), Scope.SYSTEM)); final Module submodule2 = DataModelFactory.createModule("sub2", "1"); submodule2.addDependency(DataModelFactory.createDependency(DataModelFactory.createArtifact("gr3", "art3", "123", "", "", ""), Scope.SYSTEM)); submodule1.addSubmodule(submodule2); module.addSubmodule(submodule1); final Set<Dependency> dependencies = DataUtils.getAllDependencies(module); assertEquals(3, dependencies.size()); }