Unnamed: 0
int64
0
305k
body
stringlengths
7
52.9k
name
stringlengths
1
185
254,200
void (@NotNull CodeInsightSettings settings) { if (!settings.equals(defaultSettings)) { Element newS = new Element("temp"); settings.writeExternal(newS); Element oldS = new Element("temp"); defaultSettings.writeExternal(oldS); String DEFAULT_SETTINGS_EXTERNALIZED = JDOMUtil.writeElement(oldS); Assert.assertEquals("Code...
checkCodeInsightSettingsNotOverwritten
254,201
boolean () { return TestFrameworkUtil.isPerformanceTest(getName(), getClass().getSimpleName()); }
isPerformanceTest
254,202
boolean () { String testName = getName(); String className = getClass().getSimpleName(); return TestFrameworkUtil.isStressTest(testName, className); }
isStressTest
254,203
void (@NotNull Project project) { DocumentUtil.writeInRunUndoTransparentAction(() -> { PsiDocumentManager.getInstance(project).commitAllDocuments(); PostprocessReformattingAspect.getInstance(project).doPostponedFormatting(); }); }
doPostponedFormatting
254,204
void (@NotNull Class<? extends Throwable> exceptionClass, @NotNull ThrowableRunnable<?> runnable) { assertThrows(exceptionClass, null, runnable); }
assertThrows
254,205
void (@NotNull Class<? extends Throwable> exceptionClass, @Nullable String expectedErrorMsgPart, @NotNull ThrowableRunnable<?> runnable) { boolean wasThrown = false; try { runnable.run(); } catch (Throwable e) { Throwable cause = e; while (cause instanceof TestLoggerFactory.TestLoggerAssertionError && cause.getCause() ...
assertThrows
254,206
void (@NotNull Runnable closure) { String throwableName = null; try { closure.run(); } catch (Throwable thr) { throwableName = thr.getClass().getName(); } assertNull(throwableName); }
assertNoThrowable
254,207
boolean (@NotNull Class<? extends Annotation> annotationClass) { Class<?> aClass = getClass(); String methodName = ObjectUtils.notNull(getName(), ""); boolean methodChecked = false; while (aClass != null && aClass != Object.class) { if (aClass.getAnnotation(annotationClass) != null) return true; if (!methodChecked) { M...
annotatedWith
254,208
String () { return PathManager.getHomePath().replace(File.separatorChar, '/'); }
getHomePath
254,209
void (@NotNull VirtualFile file) { VfsUtilCore.visitChildrenRecursively(file, new VirtualFileVisitor<Void>() { @Override public boolean visitFile(@NotNull VirtualFile file) { file.getChildren(); return true; } }); file.refresh(false, true); }
refreshRecursively
254,210
boolean (@NotNull VirtualFile file) { file.getChildren(); return true; }
visitFile
254,211
VirtualFile (@NotNull File file) { return UIUtil.invokeAndWaitIfNeeded(() -> LocalFileSystem.getInstance().refreshAndFindFileByIoFile(file)); }
refreshAndFindFile
254,212
void (long timeout, @NotNull TimeUnit timeUnit) { EdtTestUtil.runInEdtAndWait(() -> { Application app = ApplicationManager.getApplication(); if (app != null && !app.isDisposed()) { TestApplicationKt.waitForAppLeakingThreads(app, timeout, timeUnit); } }); }
waitForAppLeakingThreads
254,213
void () { myDisposed = true; }
dispose
254,214
boolean () { return myDisposed; }
isDisposed
254,215
String () { String testName = getTestName(false); return UsefulTestCase.this.getClass() + (StringUtil.isEmpty(testName) ? "" : ".test" + testName); }
toString
254,216
void (@NotNull String @NotNull ... dirNames) { for (String dirName : dirNames) { Path usrShareDir = Paths.get(dirName); if (Files.exists(usrShareDir)) { String absolutePath = usrShareDir.toAbsolutePath().toString(); LOG.debug(usrShareDir.toString(), " exists, adding to the list of allowed root: ", absolutePath); VfsRoo...
allowAccessToDirsIfExists
254,217
MockApplication () { return (MockApplication)ApplicationManager.getApplication(); }
getApplication
254,218
MockApplication () { MockApplication app = new MockApplication(getTestRootDisposable()); ApplicationManager.setApplication(app, () -> FileTypeManager.getInstance(), getTestRootDisposable()); app.registerService(EncodingManager.class, EncodingManagerImpl.class); return app; }
initApplication
254,219
void (@NonNls String folderName, LocalInspectionTool tool) { doTest(folderName, new LocalInspectionToolWrapper(tool)); }
doTest
254,220
void (@NonNls String folderName, @NotNull InspectionToolWrapper toolWrapper) { myFixture.testInspection(folderName, toolWrapper); }
doTest
254,221
VirtualFile (@NotNull VirtualFile root, @NotNull String relativePath) { return createFile(root, relativePath, (byte[])null); }
createFile
254,222
VirtualFile (@NotNull VirtualFile root, @NotNull String relativePath, @Nullable String text) { try { return createFileOrDir(root, relativePath, text == null ? null : VfsUtil.toByteArray(root, text), false); } catch (IOException e) { throw new RuntimeException(e); } }
createFile
254,223
VirtualFile (@NotNull VirtualFile root, @NotNull String relativePath, byte @Nullable [] data) { return createFileOrDir(root, relativePath, data, false); }
createFile
254,224
VirtualFile (@NotNull VirtualFile root, @NotNull String relativePath) { return createFileOrDir(root, relativePath, null, true); }
createDir
254,225
VirtualFile (VirtualFile root, String relativePath, byte @Nullable [] data, boolean dir) { try { return WriteAction.computeAndWait(() -> { VirtualFile parent = root; for (String name : StringUtil.tokenize(PathUtil.getParentPath(relativePath), "/")) { VirtualFile child = parent.findChild(name); if (child == null || !chi...
createFileOrDir
254,226
void (@NotNull VirtualFile file) { try { // requestor must be notnull (for GlobalUndoTest) WriteAction.runAndWait(() -> file.delete(file)); } catch (Throwable throwable) { ExceptionUtil.rethrow(throwable); } }
deleteFile
254,227
void (final @NotNull VirtualFile file) { ApplicationManager.getApplication().runWriteAction(() -> { try { VfsUtil.saveText(file, ""); } catch (IOException e) { throw new RuntimeException(e); } }); }
clearContent
254,228
void (@NotNull String filePath, @NotNull String actual) { overwriteTestData(filePath, actual, false); }
overwriteTestData
254,229
void (@NotNull String filePath, @NotNull String actual, boolean preserveSpaces) { try { File file = new File(filePath); if (preserveSpaces) { try { actual = preserveSpacesFromFile(file, actual); } catch (Throwable e) { //noinspection UseOfSystemOutOrSystemErr System.err.println("Failed to preserve spaces: " + e.getMess...
overwriteTestData
254,230
VirtualFile (@NotNull String absolutePath) { String vfsPath = FileUtil.toSystemIndependentName(absolutePath); VirtualFile vFile = LocalFileSystem.getInstance().refreshAndFindFileByPath(vfsPath); Assert.assertNotNull("file " + absolutePath + " not found", vFile); String realVfsPath = vFile.getPath(); if (!vFile.isCaseSe...
findFileByCaseSensitivePath
254,231
void (@NotNull VirtualFile file, @NotNull String suffixPath) { String vfsSuffixPath = FileUtil.toSystemIndependentName(suffixPath); String vfsPath = file.getPath(); if (!file.isCaseSensitive() && !vfsPath.endsWith(vfsSuffixPath) && StringUtil.endsWithIgnoreCase(vfsPath, vfsSuffixPath)) { String realSuffixPath = vfsPath...
assertFilePathEndsWithCaseSensitivePath
254,232
List<VFileEvent> (@NotNull Runnable action) { List<VFileEvent> allEvents = Collections.synchronizedList(new ArrayList<>()); MessageBusConnection connection = ApplicationManager.getApplication().getMessageBus().connect(); connection.subscribe(VirtualFileManager.VFS_CHANGES, new BulkFileListener() { @Override public void...
getEvents
254,233
void (@NotNull List<? extends @NotNull VFileEvent> events) { allEvents.addAll(events); }
after
254,234
List<String> (@NotNull List<? extends VFileEvent> events) { return ContainerUtil.map(events, VfsTestUtil::print); }
print
254,235
String (VFileEvent e) { char type = '?'; if (e instanceof VFileCreateEvent) type = 'C'; else if (e instanceof VFileDeleteEvent) type = 'D'; else if (e instanceof VFileContentChangeEvent) type = 'U'; else if (e instanceof VFilePropertyChangeEvent) type = 'P'; return type + " : " + e.getPath(); }
print
254,236
ShutdownToken (@NotNull Project project, @NotNull Disposable testRootDisposable) { return new ShutdownToken(null); }
setUpTestInternal
254,237
ShutdownToken (@NotNull Project project, @NotNull Disposable testRootDisposable) { EternalTaskShutdownToken dumbTask = indexEverythingAndBecomeDumb(project); RecursionManager.disableMissedCacheAssertions(testRootDisposable); return new ShutdownToken(dumbTask); }
setUpTestInternal
254,238
void (@NotNull Project project) { ApplicationManager.getApplication().invokeAndWait(() -> { new UnindexedFilesScanner(project, "TestIndexingModeSupporter").queue(); }); }
ensureIndexingStatus
254,239
ShutdownToken (@NotNull Project project, @NotNull Disposable testRootDisposable) { EternalTaskShutdownToken dumbTask = becomeDumb(project); RecursionManager.disableMissedCacheAssertions(testRootDisposable); return new ShutdownToken(dumbTask); }
setUpTestInternal
254,240
ShutdownToken (@NotNull Project project, @NotNull Disposable testRootDisposable) { ServiceContainerUtil .replaceService(ApplicationManager.getApplication(), FileBasedIndex.class, new EmptyFileBasedIndex(), testRootDisposable); EternalTaskShutdownToken dumbTask = becomeDumb(project); RecursionManager.disableMissedCacheA...
setUpTestInternal
254,241
ShutdownToken (@NotNull Project project, @NotNull Disposable testRootDisposable) { ShutdownToken shutdownToken = setUpTestInternal(project, testRootDisposable); Disposer.register(testRootDisposable, new Disposable() { @Override public void dispose() { tearDownTest(project, shutdownToken); } }); return shutdownToken; }
setUpTest
254,242
void () { tearDownTest(project, shutdownToken); }
dispose
254,243
void (@NotNull Project project, @NotNull ShutdownToken token) { if (token.dumbTask != null) { DumbModeTestUtils.endEternalDumbModeTaskAndWaitForSmartMode(project, token.dumbTask); } }
tearDownTest
254,244
void (@NotNull Project project) { }
ensureIndexingStatus
254,245
EternalTaskShutdownToken (@NotNull Project project) { return DumbModeTestUtils.startEternalDumbModeTask(project); }
becomeDumb
254,246
EternalTaskShutdownToken (@NotNull Project project) { new UnindexedFilesScanner(project, "TestIndexingModeSupporter").queue(); return becomeDumb(project); }
indexEverythingAndBecomeDumb
254,247
void (@NotNull Class<? extends TestIndexingModeSupporter> aClass, @NotNull TestIndexingModeSupporter.IndexingModeTestHandler handler, @NotNull TestSuite parentSuite) { if (handler.shouldIgnore(aClass)) return; try { TestSuite suite = handler.createTestSuite(); suite.setName(aClass.getSimpleName()); boolean foundTests =...
addTest
254,248
TestSuite () { return new NamedTestSuite(myTestNamePrefix); }
createTestSuite
254,249
boolean (@NotNull AnnotatedElement element) { return element.isAnnotationPresent(NeedsIndex.SmartMode.class); }
shouldIgnoreInFullIndexSuite
254,250
boolean (@NotNull AnnotatedElement element) { return shouldIgnoreInFullIndexSuite(element) || element.isAnnotationPresent(NeedsIndex.Full.class); }
shouldIgnoreInRuntimeOnlyIndexSuite
254,251
boolean (@NotNull AnnotatedElement element) { return shouldIgnoreInRuntimeOnlyIndexSuite(element) || element.isAnnotationPresent(NeedsIndex.ForStandardLibrary.class); }
shouldIgnoreInEmptyIndexSuite
254,252
Test (@NotNull TestCase testCase, @NotNull IndexingMode mode) { return new MyHackyJUnitTaskMirrorImpl.VmExitErrorTest(testCase, mode); }
wrapForTeamCity
254,253
void (String name) { super.setName(myPrefix + name); }
setName
254,254
int () { return myTestCase.countTestCases(); }
countTestCases
254,255
void (TestResult result) { result.startTest(this); Protectable p = new Protectable() { @Override public void protect() throws Throwable { myTestCase.runBare(); } }; result.runProtected(this, p); result.endTest(this); }
run
254,256
String () { return myTestCase.getClass().getName() + "." + myTestCase.getName() + " with IndexingMode " + myMode.name(); }
toString
254,257
Description () { return Description.createTestDescription(myTestCase.getClass(), myTestCase.getName() + "[" + myMode.name() + "]"); }
getDescription
254,258
boolean (@NotNull AnnotatedElement aClass) { return IndexingModeTestHandler.shouldIgnoreInFullIndexSuite(aClass); }
shouldIgnore
254,259
boolean (@NotNull AnnotatedElement aClass) { return IndexingModeTestHandler.shouldIgnoreInRuntimeOnlyIndexSuite(aClass); }
shouldIgnore
254,260
boolean (@NotNull AnnotatedElement aClass) { return IndexingModeTestHandler.shouldIgnoreInEmptyIndexSuite(aClass); }
shouldIgnore
254,261
OpenProjectTask () { return OpenProjectTask.build(); }
getOpenProjectOptions
254,262
void (Disposable disposable) { Sdk sdk = getSdk(); if (sdk != null) { registerJdk(sdk, disposable); } }
registerSdk
254,263
Module (@NotNull Project project) { return createModule(project, Paths.get(FileUtil.getTempDirectory(), TEST_MODULE_NAME + ".iml")); }
createMainModule
254,264
Module (@NotNull Project project, @NotNull String moduleFilePath) { return createModule(project, Paths.get(moduleFilePath)); }
createModule
254,265
Module (@NotNull Project project, @NotNull Path moduleFile) { try { // temporary workaround for IDEA-147530: otherwise if someone saved module with this name before the created module will get its settings Files.deleteIfExists(moduleFile); } catch (IOException e) { throw new RuntimeException(e); } return WriteAction.co...
createModule
254,266
String () { return EmptyModuleType.EMPTY_MODULE; }
getModuleTypeId
254,267
boolean () { return true; }
markDirForSourcesAsSourceRoot
254,268
VirtualFile (@NotNull Module module, String srcPath) { VirtualFile dummyRoot = VirtualFileManager.getInstance().findFileByUrl("temp:///"); assert dummyRoot != null; dummyRoot.refresh(false, false); VirtualFile srcRoot = doCreateSourceRoot(dummyRoot, srcPath); registerSourceRoot(module.getProject(), srcRoot); return src...
createSourceRoot
254,269
VirtualFile (VirtualFile root, String srcPath) { VirtualFile srcRoot; try { srcRoot = root.createChildDirectory(this, srcPath); cleanSourceRoot(srcRoot); } catch (IOException e) { throw new RuntimeException(e); } return srcRoot; }
doCreateSourceRoot
254,270
void (Project project, VirtualFile srcRoot) { IndexableFileSet indexableFileSet = new IndexableFileSet() { @Override public boolean isInSet(@NotNull VirtualFile file) { return file.getFileSystem() == srcRoot.getFileSystem() && project.isOpen(); } }; FileBasedIndexImpl fileBasedIndex = (FileBasedIndexImpl)FileBasedIndex...
registerSourceRoot
254,271
boolean (@NotNull VirtualFile file) { return file.getFileSystem() == srcRoot.getFileSystem() && project.isOpen(); }
isInSet
254,272
void (@NotNull Module module, @NotNull VirtualFile srcRoot) { ModuleRootModificationUtil.updateModel(module, model -> { Sdk sdk = getSdk(); if (sdk != null) { model.setSdk(sdk); } ContentEntry contentEntry = model.addContentEntry(srcRoot); if (markDirForSourcesAsSourceRoot()) { contentEntry.addSourceFolder(srcRoot, get...
createContentEntry
254,273
void (Sdk jdk, Disposable parentDisposable) { WriteAction.run(() -> ProjectJdkTable.getInstance().addJdk(jdk, parentDisposable)); }
registerJdk
254,274
void (@NotNull Module module, @NotNull ModifiableRootModel model, @NotNull ContentEntry contentEntry) { }
configureModule
254,275
MockApplication () { return app; }
getApplication
254,276
void (@NotNull ParserDefinition definition) { Language language = definition.getFileNodeType().getLanguage(); myLangParserDefinition.registerExtension(new KeyedLazyInstance<>() { @Override public String getKey() { return language.getID(); } @NotNull @Override public ParserDefinition getInstance() { return definition; }...
registerParserDefinition
254,277
String () { return language.getID(); }
getKey
254,278
ParserDefinition () { return definition; }
getInstance
254,279
void (@NotNull ParserDefinition definition, String extension) { myLanguage = definition.getFileNodeType().getLanguage(); myFileExt = extension; registerParserDefinition(definition); app.registerService(FileTypeManager.class, new MockFileTypeManager(new MockLanguageFileType(myLanguage, myFileExt))); }
configureFromParserDefinition
254,280
PluginDescriptor () { PluginDescriptor pluginDescriptor = this.pluginDescriptor; if (pluginDescriptor == null) { pluginDescriptor = new DefaultPluginDescriptor(PluginId.getId(getClass().getName() + "." + getName()), ParsingTestCase.class.getClassLoader()); this.pluginDescriptor = pluginDescriptor; } return pluginDescri...
getPluginDescriptor
254,281
MockProjectEx () { return project; }
getProject
254,282
MockPsiManager () { return myPsiManager; }
getPsiManager
254,283
String () { return PathManagerEx.getTestDataPath(); }
getTestDataPath
254,284
String () { return getTestName(myLowercaseFirstLetter); }
getTestName
254,285
boolean () { return false; }
includeRanges
254,286
boolean () { return false; }
skipSpaces
254,287
boolean () { return true; }
checkAllPsiRoots
254,288
void () { ParsingTestUtil.assertNoPsiErrorElements(myFile); }
ensureNoErrorElements
254,289
void (boolean checkResult) { doTest(checkResult, false); }
doTest
254,290
void (boolean checkResult, boolean ensureNoErrorElements) { String name = getTestName(); try { parseFile(name, loadFile(name + "." + myFileExt)); if (checkResult) { checkResult(name, myFile); if (ensureNoErrorElements) { ensureNoErrorElements(); } } else { toParseTreeText(myFile, skipSpaces(), includeRanges()); } } cat...
doTest
254,291
PsiFile (String name, String text) { myFile = createPsiFile(name, text); assertEquals("light virtual file text mismatch", text, ((LightVirtualFile)myFile.getVirtualFile()).getContent().toString()); assertEquals("virtual file text mismatch", text, LoadTextUtil.loadText(myFile.getVirtualFile())); assertEquals("doc text m...
parseFile
254,292
void (PsiFile root) { assertEquals("psi text mismatch", root.getViewProvider().getContents().toString(), root.getText()); ensureParsed(root); ensureCorrectReparse(root); checkRangeConsistency(root); }
doSanityChecks
254,293
void (PsiFile file) { file.accept(new PsiRecursiveElementWalkingVisitor() { @Override public void visitElement(@NotNull PsiElement element) { if (element instanceof ForeignLeafPsiElement) return; try { ensureNodeRangeConsistency(element, file); } catch (Throwable e) { throw new AssertionError("In " + element + " of " +...
checkRangeConsistency
254,294
void (@NotNull PsiElement element) { if (element instanceof ForeignLeafPsiElement) return; try { ensureNodeRangeConsistency(element, file); } catch (Throwable e) { throw new AssertionError("In " + element + " of " + element.getClass(), e); } super.visitElement(element); }
visitElement
254,295
void (PsiElement parent, PsiFile file) { int parentOffset = parent.getTextRange().getStartOffset(); int childOffset = 0; ASTNode child = parent.getNode().getFirstChildNode(); if (child != null) { while (child != null) { int childLength = checkChildRangeConsistency(file, parentOffset, childOffset, child); childOffset +=...
ensureNodeRangeConsistency
254,296
int (PsiFile file, int parentOffset, int childOffset, ASTNode child) { assertEquals(child.getStartOffsetInParent(), childOffset); assertEquals(child.getStartOffset(), childOffset + parentOffset); int childLength = child.getTextLength(); assertEquals(TextRange.from(childOffset + parentOffset, childLength), child.getText...
checkChildRangeConsistency
254,297
void (String textBefore, String textAfter) { var file = createFile("test." + myFileExt, textBefore); var fileAfter = createFile("test." + myFileExt, textAfter); var rangeStart = StringUtil.commonPrefixLength(textBefore, textAfter); var rangeEnd = textBefore.length() - StringUtil.commonSuffixLength(textBefore, textAfter...
doReparseTest
254,298
PsiFile (@NotNull String name, @NotNull String text) { return createFile(name + "." + myFileExt, text); }
createPsiFile
254,299
PsiFile (@NotNull String name, @NotNull String text) { LightVirtualFile virtualFile = new LightVirtualFile(name, myLanguage, text); virtualFile.setCharset(StandardCharsets.UTF_8); return createFile(virtualFile); }
createFile