void () { configureByText(JavaFileType.INSTANCE, """ class X { static void ffff() {} public static void main(String[] args){ for (int i=0; i<1000;i++) { System.out.println(i); <caret>ffff(); } } }"""); 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()); }