use of com.intellij.codeInspection.deadCode.UnusedDeclarationInspection in project intellij-community by JetBrains.
the class SuppressNonInspectionsTest method setUp.
@Override
protected void setUp() throws Exception {
super.setUp();
enableInspectionTool(new UnusedDeclarationInspection());
}
use of com.intellij.codeInspection.deadCode.UnusedDeclarationInspection in project intellij-community by JetBrains.
the class RemoveUnusedParameterTest method setUp.
@Override
protected void setUp() throws Exception {
super.setUp();
enableInspectionTool(new UnusedDeclarationInspection());
}
use of com.intellij.codeInspection.deadCode.UnusedDeclarationInspection in project intellij-community by JetBrains.
the class RemoveUnusedVariableTest method setUp.
@Override
protected void setUp() throws Exception {
super.setUp();
enableInspectionTool(new UnusedDeclarationInspection());
}
use of com.intellij.codeInspection.deadCode.UnusedDeclarationInspection in project intellij-community by JetBrains.
the class DaemonRespondToChangesTest method testUnusedMethodUpdate.
public void testUnusedMethodUpdate() throws Exception {
configureByText(JavaFileType.INSTANCE, "class X {\n" + " static void ffff() {}\n" + " public static void main(String[] args){\n" + " for (int i=0; i<1000;i++) {\n" + " System.out.println(i);\n" + " <caret>ffff();\n" + " }\n" + " }\n}");
enableInspectionTool(new UnusedDeclarationInspection(true));
List<HighlightInfo> infos = doHighlighting(HighlightSeverity.WARNING);
assertEmpty(infos);
PlatformTestUtil.invokeNamedAction(IdeActions.ACTION_COMMENT_LINE);
infos = doHighlighting(HighlightSeverity.WARNING);
assertEquals(1, infos.size());
assertEquals("Method 'ffff()' is never used", infos.get(0).getDescription());
}
use of com.intellij.codeInspection.deadCode.UnusedDeclarationInspection in project intellij-community by JetBrains.
the class DaemonRespondToChangesTest method testLocallyUsedFieldHighlighting.
public void testLocallyUsedFieldHighlighting() {
configureByText(JavaFileType.INSTANCE, "class A {\n" + " String cons;\n" + " void foo() {\n" + " String local = null;\n" + " <selection>cons</selection>.substring(1);" + " }\n" + " public static void main(String[] args) {\n" + " new A().foo();\n" + " }" + "}");
enableInspectionTool(new UnusedDeclarationInspection(true));
List<HighlightInfo> infos = doHighlighting(HighlightSeverity.WARNING);
assertSize(1, infos);
assertEquals("Variable 'local' is never used", infos.get(0).getDescription());
type("local");
infos = doHighlighting(HighlightSeverity.WARNING);
assertSize(1, infos);
assertEquals("Field 'cons' is never used", infos.get(0).getDescription());
}
Aggregations