void () { Module a = createModule("a"); Module b = createModule("b"); Module c = createModule("c"); Module d = createModule("d"); ModuleRootModificationUtil.addDependency(a, b); ModuleRootModificationUtil.addDependency(b, c, DependencyScope.COMPILE, true); ModuleRootModificationUtil.addDependency(c, d, DependencyScope.COMPILE, true); List<Map.Entry<OrderEntry, OrderEntry>> result = new ArrayList<>(findReachableViaThisDependencyOnly(a, b)); assertEquals(2, result.size()); assertSame(c, ((ModuleOrderEntry)result.get(0).getKey()).getModule()); assertSame(c, ((ModuleOrderEntry)result.get(0).getValue()).getModule()); assertSame(d, result.get(1).getKey().getOwnerModule()); assertSame(c, ((ModuleOrderEntry)result.get(1).getValue()).getModule()); }