use of com.intellij.codeInspection.deadCode.UnusedDeclarationInspection in project intellij-community by JetBrains.
the class JUnitUnusedMethodsTest method setUp.
@Override
protected void setUp() throws Exception {
super.setUp();
myFixture.addClass("package org.junit; public @interface Test {}");
myFixture.addClass("package org.junit.runners; public class Parameterized { public @interface Parameters {} public @interface Parameter {}}");
myFixture.addClass("package org.junit.runner; public @interface RunWith {Class value();}");
myFixture.enableInspections(new UnusedDeclarationInspection(true));
}
use of com.intellij.codeInspection.deadCode.UnusedDeclarationInspection in project intellij-community by JetBrains.
the class UnusedMethodParameterTest method doTest.
private void doTest() throws Exception {
UnusedDeclarationInspection declarationInspection = new UnusedDeclarationInspection();
declarationInspection.getSharedLocalInspectionTool().LOCAL_VARIABLE = false;
doTest("unusedMethodParameter/" + getTestName(true), declarationInspection);
}
use of com.intellij.codeInspection.deadCode.UnusedDeclarationInspection in project intellij-community by JetBrains.
the class RedundantSuppressTest method setUp.
@Override
protected void setUp() throws Exception {
super.setUp();
myInspectionToolWrappers = new InspectionToolWrapper[] { new LocalInspectionToolWrapper(new JavaDocReferenceInspection()), new LocalInspectionToolWrapper(new I18nInspection()), new LocalInspectionToolWrapper(new RawUseOfParameterizedTypeInspection()), new GlobalInspectionToolWrapper(new EmptyMethodInspection()), new GlobalInspectionToolWrapper(new UnusedDeclarationInspection()) };
myWrapper = new GlobalInspectionToolWrapper(new RedundantSuppressInspection() {
@NotNull
@Override
protected InspectionToolWrapper[] getInspectionTools(PsiElement psiElement, @NotNull InspectionManager manager) {
return myInspectionToolWrappers;
}
});
}
use of com.intellij.codeInspection.deadCode.UnusedDeclarationInspection in project android by JetBrains.
the class AndroidJavaHighlightingTest method testUnusedConstructors.
public void testUnusedConstructors() throws Exception {
// Regression test for https://code.google.com/p/android/issues/detail?id=77054
// Checks that various constructors are not marked as unused
final UnusedDeclarationInspection inspection = new UnusedDeclarationInspection(true);
myFixture.enableInspections(inspection);
final VirtualFile f = myFixture.copyFileToProject(BASE_PATH + getTestName(false) + ".java", "src/p1/p2/UnusedConstructors.java");
myFixture.configureFromExistingVirtualFile(f);
myFixture.checkHighlighting(true, false, true);
}
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());
}
Aggregations