boolean (@NotNull final JavaTestConfigurationWithDiscoverySupport configuration, @NotNull ConfigurationContext configurationContext, @NotNull Ref<PsiElement> ref) { if (!Registry.is(TestDiscoveryExtension.TEST_DISCOVERY_REGISTRY_KEY)) { return false; } final Location contextLocation = configurationContext.getLocation(); assert contextLocation != null; final Location location = JavaExecutionUtil.stepIntoSingleClass(contextLocation); if (location == null) return false; final PsiMethod sourceMethod = getSourceMethod(location); final Pair<String, String> position = getPosition(sourceMethod); if (sourceMethod != null && position != null) { final Project project = configuration.getProject(); final TestDiscoveryIndex testDiscoveryIndex = TestDiscoveryIndex.getInstance(project); if (testDiscoveryIndex.getTestsByMethodName(position.first, position.second, configuration.getTestFrameworkId()).isEmpty()) { return false; } Module targetModule = getTargetModule(configuration, configurationContext, position, project, testDiscoveryIndex); setupDiscoveryConfiguration(configuration, sourceMethod, targetModule); return true; } return false; }