testng: ensure configured by suite is checked (IDEA-140794)
authorAnna Kozlova <anna.kozlova@jetbrains.com>
Thu, 28 May 2015 09:54:19 +0000 (11:54 +0200)
committerAnna Kozlova <anna.kozlova@jetbrains.com>
Thu, 28 May 2015 09:59:40 +0000 (11:59 +0200)
plugins/testng/src/com/theoryinpractice/testng/model/TestNGTestSuite.java

index 5b6c594dc5cb3d80acab8a7843e71175533eca0f..23ee89153aeb6b40e2388bc78af0caf213bc2e5f 100644 (file)
@@ -21,6 +21,7 @@ import com.intellij.openapi.util.Comparing;
 import com.intellij.openapi.vfs.VirtualFile;
 import com.intellij.psi.PsiClass;
 import com.intellij.psi.PsiElement;
+import com.intellij.psi.PsiFile;
 import com.intellij.psi.PsiMethod;
 import com.intellij.psi.util.PsiUtilCore;
 import com.intellij.psi.xml.XmlFile;
@@ -66,8 +67,9 @@ public class TestNGTestSuite extends TestNGTestObject {
 
   @Override
   public boolean isConfiguredByElement(PsiElement element) {
-    if (element instanceof XmlFile) {
-      final VirtualFile virtualFile = PsiUtilCore.getVirtualFile(element);
+    final PsiFile containingFile = element.getContainingFile();
+    if (containingFile instanceof XmlFile) {
+      final VirtualFile virtualFile = PsiUtilCore.getVirtualFile(containingFile);
       return virtualFile != null && Comparing.strEqual(myConfig.getPersistantData().getSuiteName(), virtualFile.getPath());
     }
     return false;