mirror of
https://gitflic.ru/project/openide/openide.git
synced 2025-12-15 02:59:33 +07:00
tests: cleanup
GitOrigin-RevId: 4c0abf48343a2ad6c4ebfea78c20d66cd981c02b
This commit is contained in:
committed by
intellij-monorepo-bot
parent
f85e6d238f
commit
c83ce9390f
@@ -168,11 +168,11 @@ public class DaemonAnnotatorsRespondToChangesTest extends DaemonAnalyzerTestCase
|
||||
HighlightSeverity.ERROR);
|
||||
long elapsed = System.currentTimeMillis() - start;
|
||||
|
||||
assertEquals(0, errors.size());
|
||||
assertSize(0, errors);
|
||||
if (!run.get()) {
|
||||
fail(ThreadDumper.dumpThreadsToString());
|
||||
}
|
||||
assertTrue("Elapsed: "+elapsed, elapsed >= SLEEP);
|
||||
assertTrue("Elapsed: " + elapsed, elapsed >= SLEEP);
|
||||
}
|
||||
|
||||
public void testAddRemoveHighlighterRaceInIncorrectAnnotatorsWhichUseFileRecursiveVisit() {
|
||||
|
||||
@@ -157,7 +157,7 @@ public class DaemonInspectionsRespondToChangesTest extends DaemonAnalyzerTestCas
|
||||
public void testWholeFileInspection() throws Exception {
|
||||
configureByFile(DaemonRespondToChangesTest.BASE_PATH + "FieldCanBeLocal.java");
|
||||
List<HighlightInfo> infos = doHighlighting(HighlightSeverity.WARNING);
|
||||
assertEquals(1, infos.size());
|
||||
assertSize(1, infos);
|
||||
assertEquals("Field can be converted to a local variable", infos.get(0).getDescription());
|
||||
|
||||
ctrlW();
|
||||
@@ -172,7 +172,7 @@ public class DaemonInspectionsRespondToChangesTest extends DaemonAnalyzerTestCas
|
||||
type("0");
|
||||
|
||||
infos = doHighlighting(HighlightSeverity.WARNING);
|
||||
assertEquals(1, infos.size());
|
||||
assertSize(1, infos);
|
||||
assertEquals("Field can be converted to a local variable", infos.get(0).getDescription());
|
||||
}
|
||||
|
||||
|
||||
@@ -124,13 +124,13 @@ public class DaemonLineMarkersRespondToChangesTest extends DaemonAnalyzerTestCas
|
||||
|
||||
Document document = getEditor().getDocument();
|
||||
List<LineMarkerInfo<?>> markers = DaemonCodeAnalyzerImpl.getLineMarkers(document, getProject());
|
||||
assertEquals(3, markers.size());
|
||||
assertSize(3, markers);
|
||||
|
||||
type("//xxxx");
|
||||
|
||||
assertEmpty(highlightErrors());
|
||||
markers = DaemonCodeAnalyzerImpl.getLineMarkers(document, getProject());
|
||||
assertEquals(3, markers.size());
|
||||
assertSize(3, markers);
|
||||
}
|
||||
|
||||
|
||||
@@ -192,12 +192,13 @@ public class DaemonLineMarkersRespondToChangesTest extends DaemonAnalyzerTestCas
|
||||
});
|
||||
|
||||
PsiDocumentManager.getInstance(getProject()).commitAllDocuments();
|
||||
List<HighlightInfo> infosAfter = CodeInsightTestFixtureImpl.instantiateAndRun(myFile, myEditor, new int[]{/*Pass.UPDATE_ALL, Pass.LOCAL_INSPECTIONS*/}, false);
|
||||
List<HighlightInfo> infosAfter =
|
||||
CodeInsightTestFixtureImpl.instantiateAndRun(myFile, myEditor, new int[]{/*Pass.UPDATE_ALL, Pass.LOCAL_INSPECTIONS*/}, false);
|
||||
assertNotEmpty(filter(infosAfter, HighlightSeverity.ERROR));
|
||||
UIUtil.dispatchAllInvocationEvents();
|
||||
assertEmpty(changed);
|
||||
List<LineMarkerInfo<?>> lineMarkersAfter = DaemonCodeAnalyzerImpl.getLineMarkers(myEditor.getDocument(), getProject());
|
||||
assertEquals(lineMarkersAfter.size(), lineMarkers.size());
|
||||
assertSize(lineMarkersAfter.size(), lineMarkers);
|
||||
}
|
||||
|
||||
public void testLineMarkersDoNotBlinkOnBackSpaceRightBeforeMethodIdentifier() {
|
||||
|
||||
@@ -218,7 +218,7 @@ public class DaemonRespondToChangesTest extends DaemonAnalyzerTestCase {
|
||||
Document document = getDocument(getFile());
|
||||
assertNotEmpty(highlightErrors());
|
||||
List<HighlightInfo> errors = DaemonCodeAnalyzerImpl.getHighlights(document, HighlightSeverity.ERROR, getProject());
|
||||
assertEquals(1, errors.size());
|
||||
assertSize(1, errors);
|
||||
TextRange dirty = myDaemonCodeAnalyzer.getFileStatusMap().getFileDirtyScope(document, getFile(), Pass.UPDATE_ALL);
|
||||
assertNull(dirty);
|
||||
|
||||
@@ -323,14 +323,14 @@ public class DaemonRespondToChangesTest extends DaemonAnalyzerTestCase {
|
||||
""");
|
||||
Document document = getDocument(getFile());
|
||||
List<HighlightInfo> infos = doHighlighting(HighlightSeverity.WARNING);
|
||||
assertEquals(1, infos.size());
|
||||
assertSize(1, infos);
|
||||
assertEquals("Private field 'ffff' is never used", infos.get(0).getDescription());
|
||||
|
||||
type(" foo(ffff++);");
|
||||
assertEmpty(highlightErrors());
|
||||
|
||||
List<HighlightInfo> errors = DaemonCodeAnalyzerImpl.getHighlights(document, HighlightSeverity.WARNING, getProject());
|
||||
assertEquals(0, errors.size());
|
||||
assertSize(0, errors);
|
||||
}
|
||||
|
||||
public void testUnusedMethodUpdate() {
|
||||
@@ -351,7 +351,7 @@ public class DaemonRespondToChangesTest extends DaemonAnalyzerTestCase {
|
||||
PlatformTestUtil.invokeNamedAction(IdeActions.ACTION_COMMENT_LINE);
|
||||
infos = doHighlighting(HighlightSeverity.WARNING);
|
||||
|
||||
assertEquals(1, infos.size());
|
||||
assertSize(1, infos);
|
||||
assertEquals("Method 'ffff()' is never used", infos.get(0).getDescription());
|
||||
}
|
||||
|
||||
@@ -359,7 +359,7 @@ public class DaemonRespondToChangesTest extends DaemonAnalyzerTestCase {
|
||||
public void testAssignedButUnreadFieldUpdate() throws Exception {
|
||||
configureByFile(BASE_PATH + "AssignedButUnreadField.java");
|
||||
List<HighlightInfo> infos = doHighlighting(HighlightSeverity.WARNING);
|
||||
assertEquals(1, infos.size());
|
||||
assertSize(1, infos);
|
||||
assertEquals("Private field 'text' is assigned but never accessed", infos.get(0).getDescription());
|
||||
|
||||
ctrlW();
|
||||
@@ -552,7 +552,7 @@ public class DaemonRespondToChangesTest extends DaemonAnalyzerTestCase {
|
||||
}}""");
|
||||
|
||||
Collection<HighlightInfo> infos = doHighlighting(HighlightInfoType.SYMBOL_TYPE_SEVERITY);
|
||||
assertEquals(3, infos.size());
|
||||
assertSize(3, infos);
|
||||
|
||||
AtomicInteger count = new AtomicInteger();
|
||||
MarkupModelEx modelEx = (MarkupModelEx)DocumentMarkupModel.forDocument(getDocument(getFile()), getProject(), true);
|
||||
@@ -684,7 +684,7 @@ public class DaemonRespondToChangesTest extends DaemonAnalyzerTestCase {
|
||||
|
||||
try {
|
||||
Collection<HighlightInfo> errors = highlightErrors();
|
||||
assertEquals(3, errors.size());
|
||||
assertSize(3, errors);
|
||||
new GotoNextErrorHandler(true).invoke(getProject(), getEditor(), getFile());
|
||||
|
||||
List<IntentionAction> fixes = LightQuickFixTestCase.getAvailableActions(getEditor(), getFile());
|
||||
@@ -694,7 +694,7 @@ public class DaemonRespondToChangesTest extends DaemonAnalyzerTestCase {
|
||||
WriteCommandAction.runWriteCommandAction(getProject(), () -> finalFix.invoke(getProject(), getEditor(), getFile()));
|
||||
|
||||
errors = highlightErrors();
|
||||
assertEquals(2, errors.size());
|
||||
assertSize(2, errors);
|
||||
|
||||
new GotoNextErrorHandler(true).invoke(getProject(), getEditor(), getFile());
|
||||
fixes = LightQuickFixTestCase.getAvailableActions(getEditor(), getFile());
|
||||
@@ -753,7 +753,7 @@ public class DaemonRespondToChangesTest extends DaemonAnalyzerTestCase {
|
||||
|
||||
TextRange[] highlightersAfter = getHighlightersTextRange(markup);
|
||||
|
||||
assertEquals(highlightersBefore.length, highlightersAfter.length);
|
||||
assertSize(highlightersBefore.length, highlightersAfter);
|
||||
for (int i = 0; i < highlightersBefore.length; i++) {
|
||||
TextRange before = highlightersBefore[i];
|
||||
TextRange after = highlightersAfter[i];
|
||||
@@ -868,7 +868,7 @@ public class DaemonRespondToChangesTest extends DaemonAnalyzerTestCase {
|
||||
configureByText(JavaFileType.INSTANCE, "@Deprecated<caret> class S { } ");
|
||||
|
||||
List<HighlightInfo> infos = doHighlighting(HighlightInfoType.SYMBOL_TYPE_SEVERITY);
|
||||
assertEquals(2, infos.size());
|
||||
assertSize(2, infos);
|
||||
|
||||
assertEquals("@Deprecated", infos.get(0).getText());
|
||||
assertEquals("S", infos.get(1).getText());
|
||||
@@ -888,13 +888,12 @@ public class DaemonRespondToChangesTest extends DaemonAnalyzerTestCase {
|
||||
type(" ");
|
||||
|
||||
after = doHighlighting(HighlightInfoType.SYMBOL_TYPE_SEVERITY);
|
||||
assertEquals(2, after.size());
|
||||
assertSize(2, after);
|
||||
|
||||
assertEquals("@Deprecated", after.get(0).getText());
|
||||
assertEquals("S", after.get(1).getText());
|
||||
}
|
||||
|
||||
|
||||
public void testModificationInsideCodeBlockDoesNotAffectErrorMarkersOutside() {
|
||||
configureByText(JavaFileType.INSTANCE, """
|
||||
class SSSSS {
|
||||
@@ -939,7 +938,7 @@ public class DaemonRespondToChangesTest extends DaemonAnalyzerTestCase {
|
||||
}, "My", this);
|
||||
|
||||
List<HighlightInfo> errs = highlightErrors();
|
||||
assertEquals(2, errs.size());
|
||||
assertSize(2, errs);
|
||||
assertEquals("'}' expected", errs.get(0).getDescription());
|
||||
|
||||
undo();
|
||||
@@ -1012,7 +1011,7 @@ public class DaemonRespondToChangesTest extends DaemonAnalyzerTestCase {
|
||||
|
||||
type("//");
|
||||
List<HighlightInfo> errors = highlightErrors();
|
||||
assertEquals(2, errors.size());
|
||||
assertSize(2, errors);
|
||||
|
||||
backspace();
|
||||
backspace();
|
||||
@@ -1063,16 +1062,16 @@ public class DaemonRespondToChangesTest extends DaemonAnalyzerTestCase {
|
||||
((EditorImpl)myEditor).getScrollPane().getViewport().setSize(1000, 1000);
|
||||
|
||||
List<HighlightInfo> infos = doHighlighting(HighlightInfoType.SYMBOL_TYPE_SEVERITY);
|
||||
assertEquals(4, infos.size());
|
||||
assertSize(4, infos);
|
||||
|
||||
type('\n');
|
||||
infos = doHighlighting(HighlightInfoType.SYMBOL_TYPE_SEVERITY);
|
||||
assertEquals(4, infos.size());
|
||||
assertSize(4, infos);
|
||||
|
||||
deleteLine();
|
||||
|
||||
infos = doHighlighting(HighlightInfoType.SYMBOL_TYPE_SEVERITY);
|
||||
assertEquals(4, infos.size());
|
||||
assertSize(4, infos);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -236,7 +236,7 @@ public class ImportHelperTest extends LightDaemonAnalyzerTestCase {
|
||||
private static void assertOrder(@NotNull PsiJavaFile file, @NonNls String @NotNull ... expectedOrder) {
|
||||
PsiImportStatementBase[] statements = file.getImportList().getAllImportStatements();
|
||||
|
||||
assertEquals(expectedOrder.length, statements.length);
|
||||
assertSize(expectedOrder.length, statements);
|
||||
for (int i = 0; i < statements.length; i++) {
|
||||
PsiImportStatementBase statement = statements[i];
|
||||
String text = StringUtil.trimEnd(StringUtil.trimStart(statement.getText(), "import "), ";");
|
||||
@@ -296,7 +296,7 @@ public class ImportHelperTest extends LightDaemonAnalyzerTestCase {
|
||||
type(" ");
|
||||
backspace();
|
||||
|
||||
assertEquals(1, highlightErrors().size());
|
||||
assertSize(1, highlightErrors());
|
||||
UIUtil.dispatchAllInvocationEvents();
|
||||
|
||||
int offset = getEditor().getCaretModel().getOffset();
|
||||
@@ -349,7 +349,7 @@ public class ImportHelperTest extends LightDaemonAnalyzerTestCase {
|
||||
|
||||
assertEmpty(highlightErrors());
|
||||
|
||||
assertEquals(2, ((PsiJavaFile)getFile()).getImportList().getAllImportStatements().length);
|
||||
assertSize(2, ((PsiJavaFile)getFile()).getImportList().getAllImportStatements());
|
||||
}
|
||||
|
||||
public void testEnsureOptimizeImportsWhenInspectionReportsErrors() throws Exception {
|
||||
@@ -364,7 +364,7 @@ public class ImportHelperTest extends LightDaemonAnalyzerTestCase {
|
||||
|
||||
List<HighlightInfo> errs = highlightErrors();
|
||||
//error corresponding to too short class name
|
||||
assertEquals(1, errs.size());
|
||||
assertSize(1, errs);
|
||||
|
||||
assertOneImportAdded("java.util.List");
|
||||
|
||||
@@ -434,9 +434,9 @@ public class ImportHelperTest extends LightDaemonAnalyzerTestCase {
|
||||
List<HighlightInfo> errs = highlightErrors();
|
||||
|
||||
//error in import list
|
||||
assertEquals(1, errs.size());
|
||||
assertSize(1, errs);
|
||||
|
||||
assertEquals(1, ((PsiJavaFile)getFile()).getImportList().getAllImportStatements().length);
|
||||
assertSize(1, ((PsiJavaFile)getFile()).getImportList().getAllImportStatements());
|
||||
|
||||
type("/* */");
|
||||
doHighlighting();
|
||||
@@ -505,7 +505,7 @@ public class ImportHelperTest extends LightDaemonAnalyzerTestCase {
|
||||
CodeInsightSettings.getInstance().ADD_UNAMBIGIOUS_IMPORTS_ON_THE_FLY = true;
|
||||
|
||||
List<HighlightInfo> errs = highlightErrors();
|
||||
assertEquals(1, errs.size());
|
||||
assertSize(1, errs);
|
||||
|
||||
assertNoImportsAdded();
|
||||
type("/* */");
|
||||
@@ -554,7 +554,7 @@ public class ImportHelperTest extends LightDaemonAnalyzerTestCase {
|
||||
CodeInsightSettings.getInstance().ADD_UNAMBIGIOUS_IMPORTS_ON_THE_FLY = true;
|
||||
CodeInsightWorkspaceSettings.getInstance(getProject()).setOptimizeImportsOnTheFly(true, getTestRootDisposable());
|
||||
|
||||
assertEquals(1, highlightErrors().size());
|
||||
assertSize(1, highlightErrors());
|
||||
}
|
||||
|
||||
public void testAutoImportIgnoresUnresolvedImportReferences() throws ExecutionException, InterruptedException {
|
||||
|
||||
@@ -261,7 +261,7 @@ public class WolfTheProblemSolverTest extends DaemonAnalyzerTestCase {
|
||||
List<HighlightInfo> errors = highlightErrors();
|
||||
myWolfTheProblemSolver.waitForFilesQueuedForInvalidationAreProcessed();
|
||||
assertTrue(myWolfTheProblemSolver.isProblemFile(virtualFile));
|
||||
assertEquals(1, errors.size());
|
||||
assertSize(1, errors);
|
||||
type(';');
|
||||
errors = highlightErrors();
|
||||
assertEmpty(errors);
|
||||
|
||||
Reference in New Issue
Block a user