boolean ( @NotNull GradleRunConfiguration configuration, @NotNull ConfigurationContext context, @NotNull Ref<PsiElement> sourceElement ) { if (!myBaseConfigurationProducer.isMultipleElementsSelected(context)) return false; ExternalSystemTaskExecutionSettings settings = configuration.getSettings(); if (!GradleConstants.SYSTEM_ID.equals(settings.getExternalSystemId())) return false; final Location contextLocation = context.getLocation(); assert contextLocation != null; Project project = context.getProject(); List<String> tests = getTestPatterns(context); if (tests.isEmpty()) return false; TestMappings testMappings = getTestMappings(project, tests); Function1<String, VirtualFile> findTestSource = test -> getSourceFile(testMappings.getClasses().get(test)); Function1<String, String> createFilter = (test) -> createTestFilterFrom(testMappings.getClasses().get(test), testMappings.getMethods().get(test)); Module module = getModuleFromContext(context); if (module == null) return false; if (!applyTestConfiguration(settings, module, tests, findTestSource, createFilter)) return false; configuration.setName(suggestConfigurationName(tests)); setUniqueNameIfNeeded(project, configuration); JavaRunConfigurationExtensionManager.getInstance().extendCreatedConfiguration(configuration, contextLocation); return true; }