Unnamed: 0
int64
0
305k
body
stringlengths
7
52.9k
name
stringlengths
1
185
255,200
TestDataLookupStrategy () { TestDataLookupStrategy result = guessTestDataLookupStrategyOnClassLocation(); if (result == null) { result = guessTestDataLookupStrategyOnDirectoryAvailability(); } return result; }
guessTestDataLookupStrategy
255,201
boolean (Class<?> clazz) { return TestCase.class.isAssignableFrom(clazz) || TestFrameworkUtil.isJUnit4TestClass(clazz, true) || Parameterized.class.isAssignableFrom(clazz); }
isJUnitClass
255,202
TestDataLookupStrategy (Class<?> clazz) { // Check if the resulting strategy is already cached for the target class. TestDataLookupStrategy result = CLASS_STRATEGY_CACHE.get(clazz); if (result != null) return result; FileSystemLocation location = computeClassLocation(clazz); // We know that project location is ULTIMATE...
determineLookupStrategy
255,203
void (Class<?> substitutor, Class<?>... initial) { TestDataLookupStrategy strategy = determineLookupStrategy(substitutor); CLASS_STRATEGY_CACHE.clear(); for (Class<?> aClass : initial) CLASS_STRATEGY_CACHE.put(aClass, strategy); }
replaceLookupStrategy
255,204
FileSystemLocation (Class<?> clazz) { String classRootPath = PathManager.getJarPathForClass(clazz); if (classRootPath == null) { throw new IllegalStateException("Cannot find root directory for " + clazz); } File root = new File(classRootPath); if (!root.exists()) { throw new IllegalStateException("Classes root " + root...
computeClassLocation
255,205
FileSystemLocation () { return new File(PathManager.getHomePath(), "community/.idea").isDirectory() ? FileSystemLocation.ULTIMATE : FileSystemLocation.COMMUNITY; }
parseProjectLocation
255,206
TestDataLookupStrategy () { String homePath = PathManager.getHomePath(); for (Pair<TestDataLookupStrategy, String> pair : TEST_DATA_RELATIVE_PATHS) { if (new File(homePath, pair.second).isDirectory()) { return pair.first; } } return TestDataLookupStrategy.ULTIMATE; }
guessTestDataLookupStrategyOnDirectoryAvailability
255,207
void () { String baseName = BASE_PATH + getTestName(true); String ext = findExtension(); String fileName = baseName + "."+ext; try { String afterFileName = baseName + "_afterUp." + ext; EditorActionHandler handler = new MoveStatementUpAction().getHandler(); performAction(fileName, handler, afterFileName); afterFileName...
doTest
255,208
void (String fileName, EditorActionHandler handler, String afterFileName) { configureByFile(fileName); boolean enabled = handler.isEnabled(getEditor(), null, null); File file = new File(getTestDataPath(), afterFileName); if (!file.exists()) afterFileName = fileName; if (myBeforeMoveTask != null) { myBeforeMoveTask.run(...
performAction
255,209
String () { File[] files = new File(getTestDataPath() + BASE_PATH).listFiles((dir, name) -> StringUtil.startsWithConcatenation(name, getTestName(true), ".")); return FileTypeManagerEx.getInstanceEx().getExtension(files[0].getName()); }
findExtension
255,210
void (@NotNull JBPopup popup) { JBList<?> content = popup.isDisposed() ? null : UIUtil.findComponentOfType(popup.getContent(), JBList.class); if (content == null) { fail("JBList not found under " + popup.getContent()); } ListModel<?> model = content.getModel(); List<String> actualOptions = IntStream.range(0, model.getS...
doIntercept
255,211
String () { return "Popup Chooser where '" + myToSelect + "' should be selected"; }
toString
255,212
Icon (@NotNull Icon icon) { while (icon instanceof RetrievableIcon) { icon = ((RetrievableIcon)icon).retrieveIcon(); } return icon; }
unwrapRetrievableIcon
255,213
Icon (@NotNull Icon icon) { while (icon instanceof CompositeIcon compositeIcon) { if (compositeIcon.getIconCount() == 0) { break; } icon = compositeIcon.getIcon(0); } assert icon != null; return unwrapRetrievableIcon(icon); }
unwrapIcon
255,214
List<Icon> (@NotNull Icon icon) { if (icon instanceof RetrievableIcon) { return autopsyIconsFrom(((RetrievableIcon)icon).retrieveIcon()); } if (icon instanceof LayeredIcon) { return ContainerUtil.flatten(ContainerUtil.map(((LayeredIcon)icon).getAllLayers(), IconTestUtil::autopsyIconsFrom)); } if (icon instanceof RowIco...
autopsyIconsFrom
255,215
List<Icon> (Icon icon) { icon.paintIcon(new JLabel(), createMockGraphics(), 0, 0); // force to eval TimeoutUtil.sleep(1000); // give chance to evaluate UIUtil.dispatchAllInvocationEvents(); UIUtil.dispatchAllInvocationEvents(); return autopsyIconsFrom(icon); }
renderDeferredIcon
255,216
Graphics () { return new Graphics() { @Override public Graphics create() { return this; } @Override public void translate(int x, int y) { } @Override public Color getColor() { return null; } @Override public void setColor(Color c) { } @Override public void setPaintMode() { } @Override public void setXORMode(Color c1) {...
createMockGraphics
255,217
Graphics () { return this; }
create
255,218
void (int x, int y) { }
translate
255,219
Color () { return null; }
getColor
255,220
void (Color c) { }
setColor
255,221
void () { }
setPaintMode
255,222
void (Color c1) { }
setXORMode
255,223
Font () { return null; }
getFont
255,224
void (Font font) { }
setFont
255,225
FontMetrics (Font f) { return null; }
getFontMetrics
255,226
Rectangle () { return null; }
getClipBounds
255,227
void (int x, int y, int width, int height) { }
clipRect
255,228
void (int x, int y, int width, int height) { }
setClip
255,229
Shape () { return null; }
getClip
255,230
void (Shape clip) { }
setClip
255,231
void (int x, int y, int width, int height, int dx, int dy) { }
copyArea
255,232
void (int x1, int y1, int x2, int y2) { }
drawLine
255,233
void (int x, int y, int width, int height) { }
fillRect
255,234
void (int x, int y, int width, int height) { }
clearRect
255,235
void (int x, int y, int width, int height, int arcWidth, int arcHeight) { }
drawRoundRect
255,236
void (int x, int y, int width, int height, int arcWidth, int arcHeight) { }
fillRoundRect
255,237
void (int x, int y, int width, int height) { }
drawOval
255,238
void (int x, int y, int width, int height) { }
fillOval
255,239
void (int x, int y, int width, int height, int startAngle, int arcAngle) { }
drawArc
255,240
void (int x, int y, int width, int height, int startAngle, int arcAngle) { }
fillArc
255,241
void (int[] xPoints, int[] yPoints, int nPoints) { }
drawPolyline
255,242
void (int[] xPoints, int[] yPoints, int nPoints) { }
drawPolygon
255,243
void (int[] xPoints, int[] yPoints, int nPoints) { }
fillPolygon
255,244
void (String str, int x, int y) { }
drawString
255,245
void (AttributedCharacterIterator iterator, int x, int y) { }
drawString
255,246
boolean (Image img, int x, int y, ImageObserver observer) { return false; }
drawImage
255,247
boolean (Image img, int x, int y, int width, int height, ImageObserver observer) { return false; }
drawImage
255,248
boolean (Image img, int x, int y, Color bgcolor, ImageObserver observer) { return false; }
drawImage
255,249
boolean (Image img, int x, int y, int width, int height, Color bgcolor, ImageObserver observer) { return false; }
drawImage
255,250
boolean (Image img, int dx1, int dy1, int dx2, int dy2, int sx1, int sy1, int sx2, int sy2, ImageObserver observer) { return false; }
drawImage
255,251
boolean (Image img, int dx1, int dy1, int dx2, int dy2, int sx1, int sy1, int sx2, int sy2, Color bgcolor, ImageObserver observer) { return false; }
drawImage
255,252
void () { }
dispose
255,253
void (@NotNull ConflictsDialog component) { assertEquals(myConflicts, component.getConflictDescriptions()); }
doIntercept
255,254
TreeTestUtil () { return setSelection(true); }
withSelection
255,255
TreeTestUtil (boolean selection) { this.selection = selection; return this; }
setSelection
255,256
TreeTestUtil (@NotNull TreeVisitor visitor) { this.visitor = visitor; return this; }
setVisitor
255,257
TreeTestUtil (@NotNull Predicate<? super TreePath> filter) { this.filter = filter; return this; }
setFilter
255,258
TreeTestUtil (@NotNull Function<Object, String> converter) { this.converter = converter; return this; }
setConverter
255,259
TreeTestUtil () { PlatformTestUtil.expandAll(tree); return this; }
expandAll
255,260
void (@NonNls String expected) { PlatformTestUtil.waitWhileBusy(tree); Assert.assertEquals(expected, toString()); }
assertStructure
255,261
String () { StringBuilder sb = new StringBuilder(); TreeUtil.visitVisibleRows(tree, path -> { TreeVisitor.Action action = visitor.visit(path); if (filter.test(path)) { int count = path.getPathCount(); for (int i = 1; i < count; i++) sb.append(' '); Object component = path.getLastPathComponent(); if (!tree.getModel().is...
toString
255,262
DefaultMutableTreeNode (@NotNull Object object, Object... children) { if (object instanceof DefaultMutableTreeNode && ArrayUtil.isEmpty(children)) return (DefaultMutableTreeNode)object; if (object instanceof TreeNode) throw new IllegalArgumentException("do not use a tree node as a node content"); DefaultMutableTreeNode...
node
255,263
void (@NotNull JTree tree) { Assert.assertTrue(tree.getUI() instanceof BasicTreeUI); }
assertTreeUI
255,264
void (final PsiFile file, final int lineNum, final String expected) { final int offset = PsiDocumentManager.getInstance(getProject()).getDocument(file).getLineEndOffset(lineNum); final String actial = CodeStyleManager.getInstance(getProject()).getLineIndent(file, offset); assertEquals(expected, actial); }
doGetIndentTest
255,265
void (@NonNls String ext, @NonNls String before, @NonNls String after) { configureFromFileText("a." + ext, before); performAction(); checkResultByText(null, after, false); }
doTextTest
255,266
void () { type('\n'); }
performAction
255,267
CodeStyleSettings () { return CodeStyle.getSettings(getProject()); }
getCodeStyleSettings
255,268
int () { return LINE_NUMBER; }
getLineNumber
255,269
int () { return COLUMN_NUMBER; }
getColumnNumber
255,270
int () { return SELECTION_START_LINE_NUMBER; }
getSelectionStartLineNumber
255,271
int () { return SELECTION_START_COLUMN_NUMBER; }
getSelectionStartColumnNumber
255,272
int () { return SELECTION_END_LINE_NUMBER; }
getSelectionEndLineNumber
255,273
int () { return SELECTION_END_COLUMN_NUMBER; }
getSelectionEndColumnNumber
255,274
void (@NonNls String ext) { doTest(ext, true); }
doTest
255,275
void (@NonNls String ext, boolean unselect) { doTest(ext, unselect, false); }
doTest
255,276
void (@NonNls String ext, boolean unselect, boolean defaultFolding) { @NonNls final String path = "/codeInsight/selectWordAction/" + getTestName(true); configureByFile(path + "/before." + ext); if (defaultFolding) { EditorTestUtil.buildInitialFoldingsInBackground(getEditor()); } int i = 1; while (true) { final String f...
doTest
255,277
EditorActionHandler () { EditorAction action = (EditorAction)ActionManager.getInstance().getAction(IdeActions.ACTION_EDITOR_SELECT_WORD_AT_CARET); return action.getHandler(); }
getHandler
255,278
void () { doTest(1, false); }
doTest
255,279
void (int count) { doTest(count, false); doTest(count, true); }
doInvertedTest
255,280
void (int count, boolean invert) { String name = getTestName(true); String lang = name.split("[0-9_]+")[0]; String suffix = name.substring(lang.length()); suffix = StringUtil.trimStart(suffix, "_"); configureByFile("/codeInsight/commentByLine/" + lang + (invert ? "/after" : "/before") + suffix + "." + lang); for (int i...
doTest
255,281
void () { PlatformTestUtil.invokeNamedAction(IdeActions.ACTION_COMMENT_LINE); }
performAction
255,282
String () { return newFileText; }
getNewFileText
255,283
void (Editor editor) { EditorTestUtil.setCaretsAndSelection(editor, caretState); }
applyToEditor
255,284
List<InvokeTemplateAction> () { return ContainerUtil.map( TemplateManagerImpl.listApplicableTemplateWithInsertingDummyIdentifier( TemplateActionContext.surrounding(myFixture.getFile(), myFixture.getEditor())), template -> new InvokeTemplateAction(template, myFixture.getEditor(), getProject(), new HashSet<>())); }
buildSurroundersForFileTypeWithGivenExtension
255,285
void (String ext) { String baseName = getBaseName("tag"); myFixture.configureByFile(baseName + "." + ext); List<InvokeTemplateAction> actions = buildSurroundersForFileTypeWithGivenExtension(); actions.get(0).perform(); myFixture.checkResultByFile(baseName + "_after." + ext); }
doSurroundWithTagTest
255,286
void (String ext) { String baseName = getBaseName(""); myFixture.configureByFile(baseName + "." + ext); buildSurroundersForFileTypeWithGivenExtension().get(1).perform(); myFixture.checkResultByFile(baseName + "_after." + ext); }
doSurroundWithCDataTest
255,287
String (String dir) { String baseName = BASE_PATH; if (!dir.isEmpty()) baseName += dir + "/"; baseName += getTestName(false); return baseName; }
getBaseName
255,288
void (char c) { EditorActionManager.getInstance(); TypedAction action = TypedAction.getInstance(); action.actionPerformed(getEditor(), c, DataManager.getInstance().getDataContext()); }
performAction
255,289
void (String codeBefore, String expectedCodeAfter) { assertUnwrapped(codeBefore, expectedCodeAfter, 0); }
assertUnwrapped
255,290
void (String codeBefore, String expectedCodeAfter, final int option) { configureCode(codeBefore); UnwrapHandler h = new UnwrapHandler() { @Override protected void selectOption(List<? extends MyUnwrapAction> options, Editor editor, PsiFile file) { if (options.isEmpty()) return; options.get(option).perform(); } }; h.invo...
assertUnwrapped
255,291
void (List<? extends MyUnwrapAction> options, Editor editor, PsiFile file) { if (options.isEmpty()) return; options.get(option).perform(); }
selectOption
255,292
void (String code, String... expectedOptions) { configureCode(code); final List<String> actualOptions = new ArrayList<>(); UnwrapHandler h = new UnwrapHandler() { @Override protected void selectOption(List<? extends MyUnwrapAction> options, Editor editor, PsiFile file) { for (AnAction each : options) { actualOptions.ad...
assertOptions
255,293
void (List<? extends MyUnwrapAction> options, Editor editor, PsiFile file) { for (AnAction each : options) { actualOptions.add(each.getTemplatePresentation().getText()); } }
selectOption
255,294
void (final String codeBefore) { configureFromFileText(getFileNameToCreate(), createCode(codeBefore)); }
configureCode
255,295
String () { return "A.java"; }
getFileNameToCreate
255,296
String (String codeBefore) { return "public class A {\n" + " void foo() {\n" + indentTwice(codeBefore) + " }\n" + "}"; }
createCode
255,297
String (String code) { return indent(code, 2); }
indentTwice
255,298
String (String code) { return indent(code, 1); }
indent
255,299
String (String code, int times) { StringBuilder result = new StringBuilder(); for (String line : StringUtil.tokenize(code, "\n")) { result.append(" ".repeat(times)); result.append(line).append('\n'); } return result.toString(); }
indent