List<Chunk<ModuleSourceSet>> (@NotNull Collection<? extends Chunk<ModuleSourceSet>> sourceSetCycles) { final List<Set<Module>> productionCycles = new ArrayList<>(); for (Chunk<ModuleSourceSet> cycle : sourceSetCycles) { ModuleSourceSet.Type type = getCommonType(cycle); if (type == ModuleSourceSet.Type.PRODUCTION) { productionCycles.add(ModuleSourceSet.getModules(cycle.getNodes())); } } return ContainerUtil.filter(sourceSetCycles, chunk -> { if (getCommonType(chunk) != ModuleSourceSet.Type.TEST) return true; for (Set<Module> productionCycle : productionCycles) { if (productionCycle.containsAll(ModuleSourceSet.getModules(chunk.getNodes()))) return false; } return true; }); }