do not highlight method unused if referenced via overridden
[idea/community.git] / java / java-tests / testSrc / com / intellij / codeInsight / daemon / AdvHighlightingTest.java
index ca258530452f9f0847880b7d9ee2921a861b93a2..154740e6bea2fc50c24a161c16caa7964f816966 100644 (file)
@@ -18,6 +18,9 @@ package com.intellij.codeInsight.daemon;
 import com.intellij.analysis.PackagesScopesProvider;
 import com.intellij.application.options.colors.ScopeAttributesUtil;
 import com.intellij.codeInsight.daemon.impl.HighlightInfo;
+import com.intellij.codeInspection.LocalInspectionTool;
+import com.intellij.codeInspection.deadCode.UnusedDeclarationInspection;
+import com.intellij.codeInspection.unusedSymbol.UnusedSymbolLocalInspection;
 import com.intellij.openapi.application.ex.PathManagerEx;
 import com.intellij.openapi.editor.colors.EditorColorsManager;
 import com.intellij.openapi.editor.colors.EditorColorsScheme;
@@ -324,4 +327,19 @@ public class AdvHighlightingTest extends DaemonAnalyzerTestCase {
   public void testPublicClassInRightFile2() throws Exception {
     doTest(BASE_PATH + "/publicClassInRightFile/x/Y.java", BASE_PATH + "/publicClassInRightFile", false, false);
   }
+
+  @Override
+  protected LocalInspectionTool[] configureLocalInspectionTools() {
+    boolean needUnusedSymbol = getTestName(true).toLowerCase().contains("unused");
+    return needUnusedSymbol ? new LocalInspectionTool[]{new UnusedSymbolLocalInspection()} : new LocalInspectionTool[0];
+  }
+
+  public void testUnusedPublicMethodReferencedViaSubclass() throws Exception {
+    UnusedDeclarationInspection deadCodeInspection = new UnusedDeclarationInspection();
+    enableInspectionTool(deadCodeInspection);
+    //String ref = getTestDataPath() + BASE_PATH + "/unusedPublicMethodRefViaSubclass/x/X.java";
+    allowTreeAccessForAllFiles();
+
+    doTest(BASE_PATH + "/unusedPublicMethodRefViaSubclass/x/I.java", BASE_PATH + "/unusedPublicMethodRefViaSubclass", true, false);
+  }
 }