boolean (@NotNull TestNGConfiguration configuration, @NotNull ConfigurationContext context, @NotNull Ref<PsiElement> sourceElement) { final PsiElement element = context.getPsiLocation(); PsiPackage aPackage = AbstractJavaTestConfigurationProducer.checkPackage(element); if (aPackage == null) { return false; } final Location location = context.getLocation(); if (location == null) { return false; } if (!LocationUtil.isJarAttached(location, aPackage, TestNGUtil.TEST_ANNOTATION_FQN)) { return false; } final TestData data = configuration.data; data.PACKAGE_NAME = aPackage.getQualifiedName(); data.TEST_OBJECT = TestType.PACKAGE.getType(); data.setScope(setupPackageConfiguration(context, configuration, data.getScope())); configuration.setGeneratedName(); sourceElement.set(aPackage); return true; }