Unnamed: 0
int64
0
305k
body
stringlengths
7
52.9k
name
stringlengths
1
185
253,300
boolean (TestIdentifier testIdentifier) { return testIdentifier.getParentId().isPresent(); }
hasNonTrivialParent
253,301
long () { return (System.nanoTime() - myCurrentTestStart) / 1_000_000; }
getDuration
253,302
void (TestIdentifier testIdentifier) { myPrintStream.println("##teamcity[testStarted" + idAndName(testIdentifier) + " captureStandardOutput='true']"); }
testStarted
253,303
void (TestIdentifier testIdentifier, long duration) { myPrintStream.println( "##teamcity[testFinished" + idAndName(testIdentifier) + (duration > 0 ? " duration='" + duration + "'" : "") + "]"); }
testFinished
253,304
void (TestIdentifier testIdentifier, String messageName, Throwable ex, long duration, String reason) { testFailure(getName(testIdentifier), getId(testIdentifier), getParentId(testIdentifier), messageName, ex, duration, reason); }
testFailure
253,305
String (TestIdentifier testIdentifier) { String displayName = testIdentifier.getDisplayName(); return testIdentifier.getSource() .map(s -> { if (s instanceof ClassSource) { String className = ((ClassSource)s).getClassName(); if (className.equals(TestSuite.class.getName()) || className.equals(displayName)) { //class lev...
getName
253,306
void (String methodName, String id, String parentId, String messageName, Throwable ex, long duration, String reason) { final Map<String, String> attrs = new LinkedHashMap<>(); try { attrs.put("name", methodName); attrs.put("id", id); attrs.put("nodeId", id); attrs.put("parentNodeId", parentId); if (duration > 0) { attr...
testFailure
253,307
boolean (Class<?> aClass) { if (aClass == null) return false; final String throwableClassName = aClass.getName(); if (throwableClassName.equals("junit.framework.ComparisonFailure") || throwableClassName.equals("org.junit.ComparisonFailure")) { return true; } return isComparisonFailure(aClass.getSuperclass()); }
isComparisonFailure
253,308
String (Throwable ex) { final StringWriter stringWriter = new StringWriter(); final PrintWriter writer = new PrintWriter(stringWriter); ex.printStackTrace(writer); return stringWriter.toString(); }
getTrace
253,309
String (TestIdentifier identifier) { return identifier.getUniqueId(); }
getId
253,310
String (TestIdentifier testIdentifier) { String id = getId(testIdentifier); String name = getName(testIdentifier); String parentId = getParentId(testIdentifier); return " id='" + escapeName(id) + "' name='" + escapeName(name) + "' nodeId='" + escapeName(id) + "' parentNodeId='" + escapeName(parentId) + "'"; }
idAndName
253,311
String (TestIdentifier testIdentifier) { Optional<TestIdentifier> parent = myTestPlan.getParent(testIdentifier); return parent .map(identifier -> identifier.getUniqueId()) .orElse("0"); }
getParentId
253,312
String (String str) { return MapSerializerUtil.escapeStr(str, MapSerializerUtil.STD_ESCAPER2); }
escapeName
253,313
void (String[] args) { try { Launcher launcher = LauncherFactory.create(); ClassLoader classLoader = Thread.currentThread().getContextClassLoader(); ClassNameFilter nameFilter; try { nameFilter = createClassNameFilter(classLoader); } catch (Throwable e) { e.printStackTrace(); System.exit(1); return; } System.out.printl...
main
253,314
FilterResult (String className) { try { if ((Boolean)included.invoke(null, className)) { return FilterResult.included(null); } return FilterResult.excluded(null); } catch (Throwable e) { return FilterResult.excluded(e.getMessage()); } }
apply
253,315
boolean (Throwable throwable) { if (throwable instanceof AssumptionViolatedException) return true; if (throwable instanceof IgnoreException) return true; if (throwable.getClass().getName().equals(MULTIPLE_FAILURES_ERROR)) { try { Method getFailuresMethod = Class.forName(MULTIPLE_FAILURES_ERROR).getDeclaredMethod("getFa...
isIgnoringThrowable
253,316
void () { reportStatistics(); }
run
253,317
void () { if (SUCCESSFUL_RETRIES > 0) { //noinspection UseOfSystemOutOrSystemErr System.out.println("##teamcity[buildStatisticValue key='Successful test retries' value='" + SUCCESSFUL_RETRIES + "']"); } }
reportStatistics
253,318
Optional<Method> (Class<?> clazz, String methodName) { for (; clazz != null && clazz != Object.class; clazz = clazz.getSuperclass()) { var methods = Arrays.stream(clazz.getDeclaredMethods()) .filter(method -> methodName.equals(method.getName()) && method.getParameterCount() == 0).toList(); if (methods.size() > 1) { bre...
getMethodFromClass
253,319
void (Test test, boolean isSuccessful) { assert test instanceof TestCase; getMethodFromClass(test.getClass(), ((TestCase)test).getName()) .ifPresent(it -> testFinished(it, isSuccessful)); }
testFinished
253,320
void (Description testDescription, boolean isSuccessful) { getMethodFromClass(testDescription.getTestClass(), testDescription.getMethodName()) .ifPresent(it -> testFinished(it, isSuccessful)); }
testFinished
253,321
boolean () { var failedTests = FAILED_RETRIES / NUMBER; return failedTests > FAILED_TESTS_STOP_THRESHOLD; }
shouldStop
253,322
JdomAssert (@Nullable Element element) { return new JdomAssert(element); }
assertThat
253,323
PathAssertEx (@Nullable Path actual) { return new PathAssertEx(actual); }
assertThat
253,324
StringAssertEx (@Nullable String actual) { return new StringAssertEx(actual); }
assertThat
253,325
CharSequenceEx (@Nullable CharSequence actual) { return new CharSequenceEx(actual); }
assertThat
253,326
void () { ExecutorRegistry.getInstance(); }
setUp
253,327
List<DynamicTest> () { List<NamedFailure> failures = new ArrayList<>(); Set<String> unknownActions = getUnknownActions(); for (Keymap keymap : KeymapManagerEx.getInstanceEx().getAllKeymaps()) { Collection<String> ids = keymap.getActionIdList(); Set<String> uniqueIds = new HashSet<>(ids); if (ids.size() != uniqueIds.siz...
testUnknownActionIds
253,328
List<DynamicTest> () { List<NamedFailure> failures = new ArrayList<>(); Map<String, Map<Shortcut, List<String>>> expectedDuplicates = collectExpectedDuplicatedShortcuts(); Map<String, Map<Shortcut, List<String>>> actualDuplicates = collectActualDuplicatedShortcuts(); Set<String> allKeymaps = ContainerUtil.union(expecte...
testDuplicateShortcuts
253,329
boolean (String actionId) { Collection<String> ids = ((ActionManagerImpl)ActionManager.getInstance()).getParentGroupIds(actionId); for (String groupId : ids) { if (getConflictSafeGroups().contains(groupId) || isConflictSafeAction(groupId)) { return true; } } if (ids.isEmpty()) { String group = getGroupForUnknownAction(...
isConflictSafeAction
253,330
Shortcut (String s) { if (s.equals("Force touch")) { return KeymapUtil.parseMouseShortcut(s); } else if (s.contains("button")) { return KeymapUtil.parseMouseShortcut(s); } else { String[] sc = s.split(","); assert sc.length <= 2 : s; KeyStroke fst = KeyStrokeAdapter.getKeyStroke(sc[0]); assert fst != null : s; KeyStrok...
parseShortcut
253,331
String (Shortcut shortcut) { if (shortcut instanceof MouseShortcut) { return KeymapUtil.getMouseShortcutString((MouseShortcut)shortcut); } else if (shortcut instanceof KeyboardShortcut) { KeyStroke fst = ((KeyboardShortcut)shortcut).getFirstKeyStroke(); String s = getText(fst); KeyStroke snd = ((KeyboardShortcut)shortc...
getText
253,332
String (KeyStroke fst) { String text = KeyStrokeAdapter.toString(fst); int offset = text.lastIndexOf(' '); if (offset == -1) offset = 0; return text.substring(0, offset) + StringUtil.toUpperCase(text.substring(offset)); }
getText
253,333
Shortcut (Shortcut key, Keymap keymap) { return keymap.getName().startsWith(KeymapManager.MAC_OS_X_KEYMAP) ? MacOSDefaultKeymap.convertShortcutFromParent(key) : key; }
convertShortcutForParent
253,334
List<DynamicTest> () { List<NamedFailure> failures = new ArrayList<>(); for (Keymap keymap : KeymapManagerEx.getInstanceEx().getAllKeymaps()) { if (LINUX_KEYMAPS.contains(keymap.getName())) { checkLinuxKeymap(keymap, failures); } } return DynamicTests.asDynamicTests(failures, "incorrect linux shortcuts"); }
testLinuxShortcuts
253,335
void (Keymap keymap, List<? super NamedFailure> failures) { for (String actionId : keymap.getActionIdList()) { for (Shortcut shortcut : keymap.getShortcuts(actionId)) { if (shortcut instanceof KeyboardShortcut) { checkCtrlAltFn(keymap, shortcut, ((KeyboardShortcut)shortcut).getFirstKeyStroke(), failures); checkCtrlAltF...
checkLinuxKeymap
253,336
void (Keymap keymap, Shortcut shortcut, KeyStroke stroke, List<? super NamedFailure> failures) { if (stroke != null) { int modifiers = stroke.getModifiers(); int keyCode = stroke.getKeyCode(); if (KeyEvent.VK_F1 <= keyCode && keyCode <= KeyEvent.VK_F12 && (modifiers & InputEvent.CTRL_MASK) != 0 && (modifiers & InputEve...
checkCtrlAltFn
253,337
List<DynamicTest> () { List<NamedFailure> failures = new ArrayList<>(); Set<String> knownBoundActions = getBoundActions(); Keymap[] keymaps = KeymapManagerEx.getInstanceEx().getAllKeymaps(); for (Keymap keymap : keymaps) { KeymapImpl keymapImpl = (KeymapImpl)keymap; for (String actionId : keymapImpl.getActionIds()) { i...
testBoundActions
253,338
Set<String> () { return DEFAULT_UNKNOWN_ACTION_IDS; }
getUnknownActions
253,339
Set<String> () { return DEFAULT_BOUND_ACTIONS; }
getBoundActions
253,340
Collection<String> () { return DEFAULT_CONFLICT_SAFE_GROUPS; }
getConflictSafeGroups
253,341
String (@NotNull String actionId) { return actionId.equals("ChangesView.GroupBy.Module") ? "ChangesView.GroupBy" : null; }
getGroupForUnknownAction
253,342
long () { return suiteStarted; }
getSuiteStartTime
253,343
void () { List<Throwable> problems = TestAll.getLoadingClassProblems(); if (problems.isEmpty()) return; StringBuilder builder = new StringBuilder("The following test classes were not loaded:\n"); for (Throwable each : problems) { builder.append(ExceptionUtil.getThrowableText(each)).append("\n"); each.printStackTrace(Sy...
testReportClassLoadingProblems
253,344
void () { assertEncoding("file.encoding"); assertEncoding("sun.jnu.encoding"); }
testFileEncoding
253,345
void (@NotNull String property) { String encoding = System.getProperty(property); System.out.println("** " + property + "=" + encoding); assertNotNull("The property '" + property + "' is 'null'. Please check build configuration settings.", encoding); assertFalse( "The property '" + property + "' is set to a default val...
assertEncoding
253,346
void () { assertTrue( String.format("Symlink creation not supported for %s on %s (%s)", SystemProperties.getUserName(), SystemInfo.OS_NAME, SystemInfo.OS_VERSION), IoTestUtil.isSymLinkCreationSupported); assertEquals( "The `sun.io.useCanonCaches` makes `File#getCanonical*` methods unreliable and should be set to `false...
testSymlinkAbility
253,347
void () { GlobalState.checkSystemStreams(); // Rather initialize than check. }
testGlobalState
253,348
String () { return getTestName(super.getName()); }
getName
253,349
String (String name) { String buildConf = System.getProperty("teamcity.buildConfName"); return buildConf == null ? name : name + "[" + buildConf + "]"; }
getTestName
253,350
void () { boolean testDynamicExtensions = SystemProperties.getBooleanProperty("intellij.test.all.dynamic.extension.points", false); Assume.assumeTrue("intellij.test.all.dynamic.extension.points is off, no dynamic extensions to test", !DynamicExtensionPointsTester.EXTENSION_POINTS_WHITE_LIST.isEmpty() || testDynamicExte...
testDynamicExtensions
253,351
void () { TestApplicationManager.testProjectLeak(); }
testProjectLeak
253,352
void () { Collection<Language> languages = Language.getRegisteredLanguages(); Map<String, Language> displayNames = new HashMap<>(); for (Language language : languages) { Language prev = displayNames.put(language.getDisplayName(), language); if (prev != null) { fail("The languages '%s' (%s) and '%s' (%s) have the same d...
testLanguagesHaveDifferentDisplayNames
253,353
void () { long started = _FirstInSuiteTest.getSuiteStartTime(); if (started != 0) { long testSuiteDuration = System.nanoTime() - started; System.out.printf("##teamcity[buildStatisticValue key='ideaTests.totalTimeMs' value='%d']%n", testSuiteDuration / 1_000_000); } LightPlatformTestCase.reportTestExecutionStatistics();...
testStatistics
253,354
void () { FSRecords.checkFilenameIndexConsistency(); }
testFilenameIndexConsistency
253,355
void () { GlobalState.checkSystemStreams(); }
testGlobalState
253,356
Object () { if (myDiscoveryIndex == null) { Project project = ProjectManager.getInstance().getDefaultProject(); try { myDiscoveryIndexClass = Class.forName("com.intellij.execution.testDiscovery.TestDiscoveryIndex"); myDiscoveryIndex = myDiscoveryIndexClass .getConstructor(Path.class) .newInstance(Path.of(myTracesFile))...
getIndex
253,357
void () { System.out.println("Start compacting to index"); try { Object index = getIndex(); Method method = Class.forName("com.intellij.execution.testDiscovery.TestDiscoveryExtension") .getMethod("processTracesFile", String.class, String.class, byte.class, myDiscoveryIndexClass); method.invoke(null, myTracesFile, myMod...
close
253,358
void (@NotNull String traceFilePath) { Path traceFile = Paths.get(traceFilePath); Path parent = traceFile.getParent(); String zipName = traceFile.getFileName() + ".zip"; System.out.println("Preparing zip."); try { Path zipFile = parent.resolve(zipName); ZipUtil.compressFile(traceFile, zipFile); FileUtil.delete(traceFil...
zipOutput
253,359
void (Test test, Throwable t) {}
addError
253,360
void (Test test, AssertionFailedError t) {}
addFailure
253,361
void (Test test) { String className = getClassName(test); String methodName = getMethodName(test); try { Object data = getData(); Method testEnded = data.getClass().getMethod("testDiscoveryEnded", String.class, String.class); testEnded.invoke(data, className, methodName); } catch (Throwable t) { t.printStackTrace(); } ...
endTest
253,362
void (Test test) { try { Object data = getData(); Method testStarted = data.getClass().getMethod("testDiscoveryStarted", String.class, String.class); testStarted.invoke(data, getClassName(test), getMethodName(test)); } catch (Throwable t) { t.printStackTrace(); } }
startTest
253,363
String (Test test) { if (test instanceof TestCase) { String name = ((TestCase)test).getName(); if (name != null) return name; } if (test instanceof Describable) { Description description = ((Describable)test).getDescription(); String name = getMethodName(description); if (name != null) return name; } String toString = ...
getMethodName
253,364
String (Test test) { if (test instanceof Describable) { Description description = ((Describable)test).getDescription(); String name = getClassName(description); if (name != null) return name; } return test.getClass().getName(); }
getClassName
253,365
String (Description description) { try { return description.getClassName(); } catch (NoSuchMethodError e) { final String displayName = description.getDisplayName(); Matcher matcher = Pattern.compile("(.*)\\((.*)\\)").matcher(displayName); return matcher.matches() ? matcher.group(2) : displayName; } }
getClassName
253,366
String (Description description) { try { return description.getMethodName(); } catch (NoSuchMethodError e) { final String displayName = description.getDisplayName(); Matcher matcher = Pattern.compile("(.*)\\((.*)\\)").matcher(displayName); if (matcher.matches()) return matcher.group(1); return null; } }
getMethodName
253,367
void () { }
setUp
253,368
void () { myProject = null; }
tearDown
253,369
void () { for (File file : myFiles) { if (file.isFile()) { addFileTest(file); } } }
addAllTests
253,370
String () { return getClass().getName(); }
getName
253,371
void (File file) { if (!StringUtil.startsWithChar(file.getName(), '_') && !"CVS".equals(file.getName())) { if (myPattern != null && !myPattern.matcher(file.getPath()).matches()){ return; } final ActualTest t = new ActualTest(file, createTestName(file)); addTest(t); } }
addFileTest
253,372
String () { return "---"; }
getDelimiter
253,373
String (File testFile) { return testFile.getName(); }
createTestName
253,374
int () { return super.countTestCases(); }
countTestCases
253,375
String (final boolean lowercaseFirstLetter) { return ""; }
getTestName
253,376
String () { return myTestFile.getAbsolutePath() + " "; }
toString
253,377
void () { // Do nothing otherwise myTestFile will be nulled out before getName() is called. }
resetAllFields
253,378
String () { return myTestName; }
getName
253,379
TestFileSystemItem () { TestFileSystemBuilder builder = this; while (builder.myParent != null) { builder = builder.myParent; } return builder.myItem; }
build
253,380
TestFileSystemBuilder (String name) { final TestFileSystemItem item = new TestFileSystemItem(name, false, true); myItem.addChild(item); return new TestFileSystemBuilder(item, this); }
dir
253,381
TestFileSystemBuilder (String name) { final TestFileSystemItem item = new TestFileSystemItem(name, true, false); myItem.addChild(item); return new TestFileSystemBuilder(item, this); }
archive
253,382
TestFileSystemBuilder (String name) { myItem.addChild(new TestFileSystemItem(name, false, false)); return this; }
file
253,383
TestFileSystemBuilder (String name, String content) { myItem.addChild(new TestFileSystemItem(name, false, false, content)); return this; }
file
253,384
TestFileSystemBuilder () { return myParent; }
end
253,385
TestFileSystemBuilder () { return new TestFileSystemBuilder(new TestFileSystemItem("root", false, true), null); }
fs
253,386
void (final File file) { assertDirectoryEqual(file, "/"); }
assertDirectoryEqual
253,387
void (File file) { TestFileSystemItem fileItem = myChildren.values().iterator().next(); fileItem.assertFileEqual(file, "/"); }
assertFileEqual
253,388
void (File file, String relativePath) { File[] actualChildren = file.listFiles(); Set<String> notFound = new HashSet<>(myChildren.keySet()); if (actualChildren != null) { for (File child : actualChildren) { String name = child.getName(); TestFileSystemItem item = myChildren.get(name); if (item == null) { throw new Asse...
assertDirectoryEqual
253,389
void (File file, String relativePath) { try { Assert.assertEquals("in " + relativePath, myName, file.getName()); if (myArchive) { final File dirForExtracted = FileUtil.createTempDirectory("extracted_archive", null, false); ZipUtil.extract(file, dirForExtracted, null); assertDirectoryEqual(dirForExtracted, relativePath)...
assertFileEqual
253,390
TestFileSystemBuilder () { return TestFileSystemBuilder.fs(); }
fs
253,391
void (T o) { myActual.add(o.toString()); mySize++; }
putActual
253,392
void (T o) { myExpected.add(o.toString()); }
putExpected
253,393
void () { mySize = 0; myExpected.clear(); myActual.clear(); }
clear
253,394
void () { Assert.assertTrue(myActual.toString() + " " + myExpected.toString(), myActual.containsAll(myExpected)); clear(); }
assertResultsAndClear
253,395
String () { return myActual.toString(); }
toString
253,396
int () { return mySize; }
getSize
253,397
SelectInTarget () { return new SelectInTarget() { @Override public boolean canSelect(SelectInContext context) { return false; } @Override public void selectIn(SelectInContext context, boolean requestFocus) { } @Override public String getMinorViewId() { return getId(); } }; }
createSelectInTarget
253,398
boolean (SelectInContext context) { return false; }
canSelect
253,399
void (SelectInContext context, boolean requestFocus) { }
selectIn