DependencyScope (@NotNull Library library) { VirtualFile[] files = library.getFiles(OrderRootType.CLASSES); long testJars = Arrays.stream(files).filter(JUnitDependencyScopeSuggester::isTestJarRoot).count(); long regularJars = files.length - testJars; return testJars > regularJars ? DependencyScope.TEST : null; }