Unnamed: 0
int64
0
305k
body
stringlengths
7
52.9k
name
stringlengths
1
185
25,600
HgMockVcsHelper () { HgMockVcsHelper instance = new HgMockVcsHelper(myProject); ServiceContainerUtil.replaceService(myProject, AbstractVcsHelper.class, instance, myProject); return instance; }
registerMockVcsHelper
25,601
String (String... path) { return "A " + path(path); }
added
25,602
String (String... path) { return "R " + path(path); }
removed
25,603
String (String... path) { return "? " + path(path); }
unknown
25,604
String (String... path) { return "M " + path(path); }
modified
25,605
String (String... path) { return "! " + path(path); }
missing
25,606
String (String... line) { StringBuilder builder = new StringBuilder(); int linePartCount = line.length; for (int i = 0; i < linePartCount; i++) { String linePart = line[i]; builder.append(linePart); if (i < linePartCount - 1) { builder.append(File.separator); } } return builder.toString(); }
path
25,607
void () { VirtualFile file = createFileInCommand("a.txt", "new file content"); deleteFileInCommand(file); Assert.assertFalse(file.exists()); }
testDeleteNewFile
25,608
void () { showConfirmation(VcsConfiguration.StandardConfirmation.REMOVE); final VirtualFile vf = createFileInCommand("a.txt", null); myChangeListManager.ensureUpToDate(); final HgMockVcsHelper helper = registerMockVcsHelper(); helper.addListener(new VcsHelperListener() { @Override public void dialogInvoked() { fail("No dialog should be invoked, because newly added file should be silently removed from the repository"); } }); deleteFileInCommand(vf); }
testNewlyAddedFileShouldNotBePromptedForRemoval
25,609
void () { fail("No dialog should be invoked, because newly added file should be silently removed from the repository"); }
dialogInvoked
25,610
void () { VirtualFile vf = createFileInCommand("a.txt", null); myChangeListManager.commitFiles(vf); deleteFileInCommand(vf); myChangeListManager.commitFiles(vf); showConfirmation(VcsConfiguration.StandardConfirmation.REMOVE); vf = createFileInCommand("a.txt", null); myChangeListManager.ensureUpToDate(); final HgMockVcsHelper helper = registerMockVcsHelper(); helper.addListener(new VcsHelperListener() { @Override public void dialogInvoked() { fail("No dialog should be invoked, because newly added file should be silently removed from the repository"); } }); VcsTestUtil.deleteFileInCommand(myProject, vf); }
testJustDeletedAndThenAddedFileShouldNotBePromptedForRemoval
25,611
void () { fail("No dialog should be invoked, because newly added file should be silently removed from the repository"); }
dialogInvoked
25,612
TempDirTestFixture () { return myDirFixture; }
getDirFixture
25,613
VirtualFile () { if (myDir == null) { myDir = LocalFileSystem.getInstance().refreshAndFindFileByIoFile(new File(myDirFixture.getTempDirPath())); } return myDir; }
getDir
25,614
void (VirtualFile... files) { peer.addUnversionedFiles(peer.getDefaultChangeList(), Arrays.asList(files)); ensureUpToDate(); }
addUnversionedFilesToVcs
25,615
void (boolean only, VirtualFile... files) { ensureUpToDate(); final Collection<Change> changes = peer.getDefaultChangeList().getChanges(); if (only) { assertEquals(files.length, changes.size()); } final Collection<VirtualFile> filesInChangeList = new HashSet<>(); for (Change c : changes) { filesInChangeList.add(c.getVirtualFile()); } for (VirtualFile f : files) { Assert.assertTrue(filesInChangeList.contains(f)); } }
checkFilesAreInList
25,616
void (VirtualFile... files) { ensureUpToDate(); final List<Change> changes = new ArrayList<>(files.length); for (VirtualFile f : files) { changes.addAll(peer.getChangesIn(f)); } final LocalChangeList list = peer.getDefaultChangeList(); assertNotNull(list); peer.editComment(list.getName(), "A comment to a commit"); EdtTestUtil.runInEdtAndWait(() -> peer.commitChangesSynchronouslyWithResult(list, changes)); ensureUpToDate(); }
commitFiles
25,617
void () { peer.ensureUpToDate(); }
ensureUpToDate
25,618
void () { Map<String, String> filesMap = HgFileRevisionLogParser.parseCopiesFileList( "/a/b c/d.txt (a/b a/d.txt)\u0001/a/b c/(d).txt (/a/b c/(f).txt)"); assertTrue(filesMap.containsKey("a/b a/d.txt")); assertTrue(filesMap.containsKey("/a/b c/(f).txt")); assertTrue(filesMap.containsValue("/a/b c/d.txt")); assertTrue(filesMap.containsValue("/a/b c/(d).txt")); }
testParseFileCopiesWithWhitespaces
25,619
void () { Map<String, String> filesMap = HgFileRevisionLogParser.parseCopiesFileListAsOldVersion( "/a/b c/d.txt (a/b a/d.txt)/a/b c/(d).txt (/a/b c/(f).txt)"); assertTrue(filesMap.containsKey("a/b a/d.txt")); assertTrue(filesMap.containsKey("/a/b c/(f).txt")); assertTrue(filesMap.containsValue("/a/b c/d.txt")); assertTrue(filesMap.containsValue("/a/b c/(d).txt")); }
testParseFileCopiesOldVersion
25,620
void () { assertEquals(HgUtil.parseUserNameAndEmail("Vasya Pavlovich Pupkin <asdasd@localhost>"), new Couple<>("Vasya Pavlovich Pupkin", "asdasd@localhost")); assertEquals(HgUtil.parseUserNameAndEmail("Vasya Pavlovich Pupkin"), new Couple<>("Vasya Pavlovich Pupkin", "")); assertEquals(HgUtil.parseUserNameAndEmail("vasya.pupkin@localhost.com"), new Couple<>("", "vasya.pupkin@localhost.com")); assertEquals(HgUtil.parseUserNameAndEmail("<vasya.pupkin@localhost.com>"), new Couple<>("", "vasya.pupkin@localhost.com")); assertEquals(HgUtil.parseUserNameAndEmail("<vasya@localhost.com>"), new Couple<>("", "vasya@localhost.com")); assertEquals(HgUtil.parseUserNameAndEmail("Vasya <vas@localhost.com>"), new Couple<>("Vasya", "vas@localhost.com")); }
testParseUserNameAndEmail
25,621
Collection<Object[]> () { return List.of(new Object[][]{ {"DEFAULT_1", """ pushing to /Users/user/TTT/AHG searching for changes adding changesets adding manifests adding file changes added 1 changesets with 1 changes to 1 files""", 1}, {"DEFAULT_2", """ pushing to /Users/user/TTT/AHG searching for changes adding changesets adding manifests adding file changes added 2 changesets with 3 changes to 1 files""", 2}, {"EXTENSION_KILN_ONE", """ hg push http://<my repo> pushing to http://<my repo> searching for changes "remote: kiln: successfully pushed one changeset""", 1}, {"EXTENSION_KILN_4", """ hg push http://<my repo> pushing to http://<my repo> searching for changes remote: kiln: successfully pushed 4 changesets""", 4} }); }
createData
25,622
void () { ProcessOutput processOutput = new ProcessOutput(0); processOutput.appendStdout(myOutput); assertEquals(" Wrong commits number for " + myOutput, myExpected, HgPusher.getNumberOfPushedCommits(new HgCommandResult(processOutput))); }
testValid
25,623
Collection<Object[]> () { return Arrays.asList(createParams("4.12"), createParams("4.11"), createParams("4.10")); }
data
25,624
Object[] (final String version) { return new Object[]{version}; }
createParams
25,625
void () { Registry.get(TestDiscoveryExtension.TEST_DISCOVERY_REGISTRY_KEY).setValue(true, myProject); }
before
25,626
void (String className, String methodName, Pair<String, String>... expectedTests) { PsiClass aClass = myJavaFacade.findClass(className); PsiMethod method = "<init>".equals(methodName) ? assertOneElement(aClass.getConstructors()) : assertOneElement(aClass.findMethodsByName(methodName, false)); Couple<String> methodKey = ShowAffectedTestsAction.getMethodKey(method); TestDiscoveryIndex testDiscoveryIndex = TestDiscoveryIndex.getInstance(myProject); MultiMap<String, String> rawActualTests1 = testDiscoveryIndex.getTestsByMethodName(methodKey.getFirst(), methodKey.getSecond(), JUnitConfiguration.FRAMEWORK_ID); MultiMap<String, String> rawActualTests2 = testDiscoveryIndex.getTestsByClassName(className, JUnitConfiguration.FRAMEWORK_ID); Set<Pair<String, String>> actualTests1 = rawActualTests1.entrySet().stream().flatMap(e -> e.getValue().stream().map(m -> Pair.create(e.getKey(), m))) .collect(Collectors.toSet()); Set<Pair<String, String>> actualTests2 = rawActualTests2.entrySet().stream().flatMap(e -> e.getValue().stream().map(m -> Pair.create(e.getKey(), m))) .collect(Collectors.toSet()); assertEquals(ContainerUtil.newHashSet(expectedTests), actualTests1); assertEquals(ContainerUtil.newHashSet(expectedTests), actualTests2); Set<String> modules = actualTests1 .stream() .flatMap( test -> testDiscoveryIndex.getTestModulesByMethodName(test.getFirst(), test.getSecond(), JUnitConfiguration.FRAMEWORK_ID).stream()) .collect(Collectors.toSet()); String module = assertOneElement(modules); assertEquals(myModule.getName(), module); for (Pair<String, String> test : expectedTests) { assertTrue(testDiscoveryIndex.hasTestTrace(test.getFirst(), test.getSecond(), JUnitConfiguration.FRAMEWORK_ID)); } assertFalse(testDiscoveryIndex.hasTestTrace("dummy test name", "123", JUnitConfiguration.FRAMEWORK_ID)); }
assertTestDiscoveryIndex
25,627
String () { return VfsUtilCore.pathToUrl(PlatformTestUtil.getCommunityPath() + "/plugins/junit5_rt_tests/testData/integration/testDiscovery/" + getTestName(true)); }
getTestContentRoot
25,628
void () {}
abc
25,629
void () {}
cde
25,630
void (PsiReference reference) { assertNotNull(reference); PsiElement resolved = reference.resolve(); assertNotNull(resolved); assertTrue(resolved instanceof PsiEnumConstant); assertEquals("AAA", ((PsiEnumConstant)resolved).getName()); assertEquals("Foo", ((PsiEnumConstant)resolved).getContainingClass().getName()); assertVariants(reference, true); }
assertReference
25,631
void (PsiReference reference, boolean expectEnumValues) { final String[] variants = Arrays.stream(reference.getVariants()) .filter(LookupElement.class::isInstance) .map(LookupElement.class::cast) .map(LookupElement::getLookupString) .toArray(String[]::new); final boolean containsEnumValues = ArrayUtil.contains("AAA", variants) && ArrayUtil.contains("AAX", variants) && ArrayUtil.contains("BBB", variants); if (expectEnumValues) { assertTrue(containsEnumValues, "Completion variants: " + Arrays.toString(variants)); } else { assertFalse(containsEnumValues, "Completion variants: " + Arrays.toString(variants)); } }
assertVariants
25,632
void () { myFixture.addClass("package org.junit.jupiter.params.provider;" + "public @interface EnumSource {" + " Class<? extends Enum<?>> value();" + " String[] names() default {};" + " Mode mode() default Mode.INCLUDE;" + " enum Mode {" + " INCLUDE," + " EXCLUDE," + " MATCH_ALL," + " MATCH_ANY }" + "}"); }
addEnumSourceClass
25,633
void () { myFixture.addClass("package org.junit.jupiter.params.provider;" + "public @interface EnumSource {" + " Class<? extends Enum<?>> value();" + " String[] names() default {};" + "}"); }
addEnumSourceClassWithoutMode
25,634
void () { myFixture.addClass("enum Foo { AAA, AAX, BBB }"); }
addFooEnum
25,635
void (String text, String expected) { myFixture.configureByText("MyTest.java", text); new BaseGenerateTestSupportMethodAction.MyHandler(TestIntegrationUtils.MethodKind.TEST) .invoke(myFixture.getProject(), myFixture.getEditor(), myFixture.getFile()); myFixture.checkResult(expected); }
doTest
25,636
Optional<String> (String key) { return Optional.empty(); }
get
25,637
Optional<Boolean> (String key) { return Optional.empty(); }
getBoolean
25,638
int () { return 0; }
size
25,639
Set<String> () { return null; }
keySet
25,640
void (int b) { myBuf.append(new String(new byte[]{(byte)b}, StandardCharsets.UTF_8)); }
write
25,641
long () { return 0; }
getDuration
25,642
String (Throwable ex) { return "TRACE"; }
getTrace
25,643
DefaultJupiterConfiguration () { return new DefaultJupiterConfiguration(EMPTY_PARAMETER); }
createJupiterConfiguration
25,644
String () { TestIdentifier testIdentifier = TestIdentifier.from(new ConfigurableTestDescriptor(myTestSource)); return JUnit5TestExecutionListener.getLocationHint(testIdentifier, null); }
locationHint
25,645
String () { return locationHintValue(new ConfigurableTestDescriptor(myTestSource)); }
locationHintValue
25,646
String (final ConfigurableTestDescriptor descriptor) { TestIdentifier testIdentifier = TestIdentifier.from(descriptor); return JUnit5TestExecutionListener.getLocationHintValue(testIdentifier.getSource().orElseThrow(IllegalStateException::new), null); }
locationHintValue
25,647
ClassSource () { return ClassSource.from(String.class); }
anySupportedSource
25,648
TestSource () { return ClassSource.from(String.class); }
methodOrClassSource
25,649
TestSource () { return new TestSource() { }; }
anyUnsupportedTestSource
25,650
UniqueId () { return UniqueId.forEngine("stand in"); }
anyUniqueId
25,651
String () { return "stand in"; }
anyDisplayName
25,652
Type () { return myIsTest ? Type.TEST : Type.CONTAINER; }
getType
25,653
void (boolean isTest) { myIsTest = isTest; }
isTest
25,654
String () { return VfsUtilCore.pathToUrl(PlatformTestUtil.getCommunityPath() + "/plugins/junit5_rt_tests/testData/integration/forkProject"); }
getTestContentRoot
25,655
JUnitConfiguration (final String packageName) { PsiPackage aPackage = JavaPsiFacade.getInstance(myProject).findPackage(packageName); assertNotNull(aPackage); RunConfiguration configuration = createConfiguration(aPackage); assertInstanceOf(configuration, JUnitConfiguration.class); return (JUnitConfiguration)configuration; }
createRunPackageConfiguration
25,656
Collection<Object[]> () { return Arrays.asList(createParams("4.12"), createParams("4.11"), createParams("4.10"), createParams("4.9"), createParams("4.8.2"), createParams("4.5"), createParams("4.4") ); }
data
25,657
Object[] (final String version) { return new Object[]{version}; }
createParams
25,658
void () { JavaAwareProjectJdkTableImpl.removeInternalJdkInTests(); }
after
25,659
String () { return VfsUtilCore.pathToUrl(PlatformTestUtil.getCommunityPath() + "/plugins/junit5_rt_tests/testData/integration/custom5Project"); }
getTestContentRoot
25,660
String () { return VfsUtilCore.pathToUrl(PlatformTestUtil.getCommunityPath() + "/plugins/junit5_rt_tests/testData/integration/spock"); }
getTestContentRoot
25,661
Collection<Object[]> () { return Arrays.asList(new Object[] {"1.2-groovy-2.5"}, new Object[] {"2.0-groovy-2.5"}); }
data
25,662
String () { return VfsUtilCore.pathToUrl(PlatformTestUtil.getCommunityPath() + "/plugins/junit5_rt_tests/testData/integration/parameterized"); }
getTestContentRoot
25,663
Object[] (final String mavenId, String src, String paramString) { return new Object[]{mavenId, src, paramString}; }
createParams
25,664
String () { return VfsUtilCore.pathToUrl(PlatformTestUtil.getCommunityPath() + "/plugins/junit5_rt_tests/testData/integration/mixed45Project"); }
getTestContentRoot
25,665
Object (@NotNull @NonNls String dataId) { if (LangDataKeys.PSI_ELEMENT_ARRAY.is(dataId)) { return elements; } return super.getData(dataId); }
getData
25,666
void (ProcessOutput processOutput) { assertEmpty(processOutput.out); assertEmpty(processOutput.err); assertSize(0, processOutput.messages.stream().filter(TestIgnored.class::isInstance).map(TestIgnored.class::cast) .collect(Collectors.toList())); }
assertNoIgnored
25,667
RunConfiguration (final String packageName) { PsiPackage aPackage = JavaPsiFacade.getInstance(myProject).findPackage(packageName); assertNotNull(aPackage); RunConfiguration configuration = createConfiguration(aPackage); assertInstanceOf(configuration, JUnitConfiguration.class); return configuration; }
createRunPackageConfiguration
25,668
RunConfiguration (final String packageName) { PsiPackage aPackage = JavaPsiFacade.getInstance(myProject).findPackage(packageName); assertNotNull(aPackage); PsiDirectory[] directories = aPackage.getDirectories(GlobalSearchScope.moduleTestsWithDependentsScope(myModule)); assertTrue(directories.length > 0); JUnitConfiguration configuration = new JUnitConfiguration("dir", myProject); JUnitConfiguration.Data data = configuration.getPersistentData(); data.TEST_OBJECT = JUnitConfiguration.TEST_DIRECTORY; data.setDirName(directories[0].getVirtualFile().getPath()); configuration.setModule(ModuleUtilCore.findModuleForPsiElement(directories[0])); return configuration; }
createRunDirectoryConfiguration
25,669
String () { return VfsUtilCore.pathToUrl(PlatformTestUtil.getCommunityPath() + "/plugins/junit5_rt_tests/testData/integration/forkProjectWithModuleInfo"); }
getTestContentRoot
25,670
void (int size, ProcessOutput processOutput) { assertEquals("error output" + processOutput.err.toString() + "\n commandline: " + processOutput.sys.toString(), size, ContainerUtil.filter(processOutput.messages, TestStarted.class::isInstance).size()); }
assertStartedEvents
25,671
String () { return VfsUtilCore.pathToUrl(PlatformTestUtil.getCommunityPath() + "/plugins/junit5_rt_tests/testData/integration/params/") + mySrc; }
getTestContentRoot
25,672
Collection<Object[]> () { return Arrays.asList(createParams("com.tngtech.junit.dataprovider:junit4-dataprovider:2.6", "dataProvider", "[1: 1]"), createParams("com.carrotsearch.randomizedtesting:randomizedtesting-runner:2.7.8", "randomizedtesting", "[value=1]"), createParams("com.google.testparameterinjector:test-parameter-injector:1.3", "testparameterinjector", "[1]"), createParams("com.google.testparameterinjector:test-parameter-injector:1.3", "testparameterinjectorfield", "[a=1]") ); }
data
25,673
Object[] (final String mavenId, String src, String paramString) { return new Object[]{mavenId, src, paramString}; }
createParams
25,674
String () { return VfsUtilCore.pathToUrl(PlatformTestUtil.getCommunityPath() + "/plugins/junit5_rt_tests/testData/integration/splitModulePath"); }
getTestContentRoot
25,675
void () { myStr = "myStr"; }
initData
25,676
void () { Assert.assertTrue("myStr".equals(myStr)); }
simple
25,677
void () { org.junit.Assert.fail("junit 4: single method failed"); }
singleMethodTest
25,678
void () { System.out.println("Test" + value); }
simple
25,679
Iterable<Object[]> () { return Arrays.asList($$( $(1), $(2))); }
parameters
25,680
void () { System.out.println("Test" + a); }
simple
25,681
Object[][] () { // @formatter:off return new Object[][] { { 0 }, { 1 }, { 2 } /* ... */ }; // @formatter:on }
dataProviderAdd
25,682
void (int a) { System.out.println("Test" + a); }
simple
25,683
String () { return "FooBar"; }
getId
25,684
TestDescriptor (EngineDiscoveryRequest discoveryRequest, UniqueId uniqueId) { throw new RuntimeException("The Bad. The Ugly. No Good"); }
discover
25,685
void (ExecutionRequest request) { }
execute
25,686
Optional<String> () { return Optional.empty(); }
getGroupId
25,687
Optional<String> () { return Optional.empty(); }
getArtifactId
25,688
Optional<String> () { return Optional.empty(); }
getVersion
25,689
List<Integer> () { return Arrays.asList(1, 2); }
params
25,690
void () { org.junit.Assert.assertEquals(new Person("Foo"), new Person("Bar")); }
testPerson
25,691
String () { return name; }
getName
25,692
void () { org.junit.Assert.assertEquals("Andromeda", new Person("Andromeda").getName()); }
testPersonName
25,693
void () { org.junit.Assert.assertEquals("Andromeda", new Person("Andromeda").getName()); }
testPersonName
25,694
String () { return name; }
getName
25,695
void () { org.junit.Assert.assertEquals("Andromeda", new Person("Andromeda").getName()); }
testPersonName
25,696
String () { return name; }
getName
25,697
void () { org.junit.Assert.assertEquals("Andromeda", new Person("Andromeda").getName()); }
testPersonName1
25,698
void () { org.junit.Assert.assertEquals("Andromeda", new Person("Andromeda").getName()); }
testPersonName2
25,699
String () { return name; }
getName