This commit is contained in:
Alexey Kudravtsev
2012-06-01 16:51:29 +04:00
parent 3f157aa927
commit 0bbd7b7375
8 changed files with 32 additions and 30 deletions
@@ -7,7 +7,6 @@ import com.intellij.codeInsight.daemon.impl.quickfix.ImportClassFix;
import com.intellij.codeInsight.daemon.impl.quickfix.ImportClassFixBase;
import com.intellij.codeInspection.LocalInspectionTool;
import com.intellij.codeInspection.unusedImport.UnusedImportLocalInspection;
import com.intellij.lang.annotation.HighlightSeverity;
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.command.CommandProcessor;
import com.intellij.openapi.command.WriteCommandAction;
@@ -54,7 +53,7 @@ public class ImportHelperTest extends DaemonAnalyzerTestCase {
public void testImportsInsertedAlphabetically() throws Throwable {
@NonNls String text = "class I {}";
final PsiJavaFile file = (PsiJavaFile)configureByText(StdFileTypes.JAVA, text);
assertEmpty(filter(doHighlighting(), HighlightSeverity.ERROR));
assertEmpty(highlightErrors());
CommandProcessor.getInstance().executeCommand(
getProject(), new Runnable() {
@Override
@@ -109,7 +108,7 @@ public class ImportHelperTest extends DaemonAnalyzerTestCase {
"class I {{ max(0, 0); Map.class.hashCode(); min(0,0); Component.class.hashCode(); int i = CENTER; }}";
final PsiJavaFile file = (PsiJavaFile)configureByText(StdFileTypes.JAVA, text);
assertEmpty(filter(doHighlighting(), HighlightSeverity.ERROR));
assertEmpty(highlightErrors());
CommandProcessor.getInstance().executeCommand(
getProject(), new Runnable() {
@Override
@@ -178,7 +177,7 @@ public class ImportHelperTest extends DaemonAnalyzerTestCase {
@WrapInCommand
public void testReimportConflictingClasses() throws Exception {
configureByFile(BASE_PATH+"/x/Usage.java", BASE_PATH);
assertEmpty(filter(doHighlighting(), HighlightSeverity.ERROR));
assertEmpty(highlightErrors());
CodeStyleSettings settings = CodeStyleSettingsManager.getSettings(getProject()).clone();
settings.CLASS_COUNT_TO_USE_IMPORT_ON_DEMAND = 2;
@@ -204,7 +203,7 @@ public class ImportHelperTest extends DaemonAnalyzerTestCase {
@WrapInCommand
public void testConflictingClassesFromCurrentPackage() throws Throwable {
final PsiFile file = configureByText(StdFileTypes.JAVA, "package java.util; class X{ Date d;}");
assertEmpty(filter(doHighlighting(), HighlightSeverity.ERROR));
assertEmpty(highlightErrors());
new WriteCommandAction.Simple(getProject()) {
@Override
@@ -229,7 +228,7 @@ public class ImportHelperTest extends DaemonAnalyzerTestCase {
type(" ");
backspace();
assertOneElement(filter(doHighlighting(), HighlightSeverity.ERROR));
assertOneElement(highlightErrors());
int offset = myEditor.getCaretModel().getOffset();
PsiReference ref = myFile.findReferenceAt(offset - 1);
@@ -244,7 +243,7 @@ public class ImportHelperTest extends DaemonAnalyzerTestCase {
assertEquals(ImportClassFixBase.Result.CLASS_AUTO_IMPORTED, result);
UIUtil.dispatchAllInvocationEvents();
assertEmpty(filter(doHighlighting(), HighlightSeverity.ERROR));
assertEmpty(highlightErrors());
}
finally {
CodeInsightSettings.getInstance().ADD_UNAMBIGIOUS_IMPORTS_ON_THE_FLY = old;
@@ -261,7 +260,7 @@ public class ImportHelperTest extends DaemonAnalyzerTestCase {
type(" ");
backspace();
assertEquals(2, filter(doHighlighting(), HighlightSeverity.ERROR).size());
assertEquals(2, highlightErrors().size());
UIUtil.dispatchAllInvocationEvents();
int offset = myEditor.getCaretModel().getOffset();
@@ -272,7 +271,7 @@ public class ImportHelperTest extends DaemonAnalyzerTestCase {
assertEquals(ImportClassFixBase.Result.CLASS_AUTO_IMPORTED, result);
UIUtil.dispatchAllInvocationEvents();
assertEmpty(filter(doHighlighting(), HighlightSeverity.ERROR));
assertEmpty(highlightErrors());
}
finally {
CodeInsightSettings.getInstance().ADD_UNAMBIGIOUS_IMPORTS_ON_THE_FLY = old;
@@ -363,7 +362,7 @@ public class ImportHelperTest extends DaemonAnalyzerTestCase {
DaemonCodeAnalyzerSettings.getInstance().setImportHintEnabled(true);
try {
List<HighlightInfo> errs = filter(doHighlighting(), HighlightSeverity.ERROR);
List<HighlightInfo> errs = highlightErrors();
assertEquals(1, errs.size());
@@ -389,7 +388,7 @@ public class ImportHelperTest extends DaemonAnalyzerTestCase {
DaemonCodeAnalyzerSettings.getInstance().setImportHintEnabled(true);
try {
List<HighlightInfo> errs = filter(doHighlighting(), HighlightSeverity.ERROR);
List<HighlightInfo> errs = highlightErrors();
assertEquals(1, errs.size());
assertEmpty(((PsiJavaFile)getFile()).getImportList().getAllImportStatements());
@@ -138,13 +138,13 @@ public class LightAdvHighlightingJdk7Test extends LightDaemonAnalyzerTestCase {
enableInspectionTool(deadCodeInspection);
doTest(true, false);
List<HighlightInfo> infos = DaemonAnalyzerTestCase.filter(doHighlighting(), HighlightSeverity.WARNING);
List<HighlightInfo> infos = doHighlighting(HighlightSeverity.WARNING);
assertEquals(2, infos.size()); // unused class and unused method
try {
point.registerExtension(extension);
infos = DaemonAnalyzerTestCase.filter(doHighlighting(), HighlightSeverity.WARNING);
infos = doHighlighting(HighlightSeverity.WARNING);
HighlightInfo info = assertOneElement(infos);
assertEquals("Class 'WithMain' is never used", info.description);
}
@@ -19,7 +19,6 @@ import com.intellij.codeInsight.daemon.impl.HighlightInfo;
import com.intellij.codeInsight.intention.IntentionManager;
import com.intellij.concurrency.JobSchedulerImpl;
import com.intellij.lang.LanguageAnnotators;
import com.intellij.lang.annotation.HighlightSeverity;
import com.intellij.lang.injection.MultiHostInjector;
import com.intellij.openapi.Disposable;
import com.intellij.openapi.application.ex.PathManagerEx;
@@ -107,7 +106,7 @@ public class LightAdvHighlightingPerformanceTest extends LightDaemonAnalyzerTest
}
}).cpuBound().usesAllCPUCores().assertTiming();
return DaemonAnalyzerTestCase.filter(infos, HighlightSeverity.ERROR);
return highlightErrors();
}
public void testAThinlet() throws Exception {
@@ -54,8 +54,6 @@ import org.jetbrains.annotations.NotNull;
import java.io.IOException;
import java.util.List;
import static com.intellij.codeInsight.daemon.DaemonAnalyzerTestCase.filter;
/**
* This class is for "lightweight" tests only, i.e. those which can run inside default light project set up
* For "heavyweight" tests use AdvHighlightingTest
@@ -275,7 +273,7 @@ public class LightAdvHighlightingTest extends LightDaemonAnalyzerTestCase {
}
});
List<HighlightInfo> infos = filter(doHighlighting(), HighlightSeverity.WARNING);
List<HighlightInfo> infos = doHighlighting(HighlightSeverity.WARNING);
assertEmpty(infos);
}
@@ -327,7 +325,7 @@ public class LightAdvHighlightingTest extends LightDaemonAnalyzerTestCase {
public void testSOEForTypeOfHugeBinaryExpression() throws IOException {
configureFromFileText("a.java", "class A { String s = \"\"; }");
assertEmpty(filter(doHighlighting(), HighlightSeverity.ERROR));
assertEmpty(highlightErrors());
PsiDocumentManager.getInstance(getProject()).commitAllDocuments();
final StringBuilder sb = new StringBuilder("\"-\"");
@@ -3,13 +3,11 @@ package com.intellij.codeInsight.daemon;
import com.intellij.codeInsight.daemon.impl.HighlightInfo;
import com.intellij.codeInspection.LocalInspectionTool;
import com.intellij.codeInspection.unusedSymbol.UnusedSymbolLocalInspection;
import com.intellij.idea.Bombed;
import com.intellij.lang.annotation.HighlightSeverity;
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.editor.Document;
import com.intellij.psi.PsiDocumentManager;
import com.intellij.lang.annotation.HighlightSeverity;
import java.util.Calendar;
import java.util.Collection;
public class UnusedSymbolLocalTest extends DaemonAnalyzerTestCase {
@@ -29,7 +27,7 @@ public class UnusedSymbolLocalTest extends DaemonAnalyzerTestCase {
public void testChangeInsideCodeBlock() throws Exception {
doTest();
final Document document = myEditor.getDocument();
Collection<HighlightInfo> collection = filter(doHighlighting(), HighlightSeverity.WARNING);
Collection<HighlightInfo> collection = doHighlighting(HighlightSeverity.WARNING);
assertEquals(0, collection.size());
final int offset = myEditor.getCaretModel().getOffset();
@@ -42,7 +40,7 @@ public class UnusedSymbolLocalTest extends DaemonAnalyzerTestCase {
PsiDocumentManager.getInstance(getProject()).commitDocument(document);
Collection<HighlightInfo> infos = filter(doHighlighting(), HighlightSeverity.WARNING);
Collection<HighlightInfo> infos = doHighlighting(HighlightSeverity.WARNING);
assertEquals(1, infos.size());
}
@@ -27,7 +27,7 @@ public class SliceTreeTest extends LightDaemonAnalyzerTestCase {
PsiDocumentManager.getInstance(getProject()).commitAllDocuments();
PsiElement element = new SliceHandler(true).getExpressionAtCaret(getEditor(), getFile());
assertNotNull(element);
Collection<HighlightInfo> errors = DaemonAnalyzerTestCase.filter(doHighlighting(), HighlightSeverity.ERROR);
Collection<HighlightInfo> errors = highlightErrors();
assertEmpty(errors);
SliceAnalysisParams params = new SliceAnalysisParams();