Unnamed: 0 int64 0 305k | body stringlengths 7 52.9k | name stringlengths 1 185 |
|---|---|---|
17,200 | void (Throwable throwable) { empty.setThrowable(throwable); } | setThrowable |
17,201 | long () { return empty.getEndMillis(); } | getEndMillis |
17,202 | long () { return empty.getStartMillis(); } | getStartMillis |
17,203 | String () { return empty.toString(); } | toString |
17,204 | String () { return empty.getHost(); } | getHost |
17,205 | void (String host) { empty.setHost(host); } | setHost |
17,206 | Object[] () { return empty.getParameters(); } | getParameters |
17,207 | void (Object[] parameters) { empty.setParameters(parameters); } | setParameters |
17,208 | Object () { return empty.getInstance(); } | getInstance |
17,209 | Object[] () { return empty.getFactoryParameters(); } | getFactoryParameters |
17,210 | Object (String name) { return empty.getAttribute(name); } | getAttribute |
17,211 | void (String name, Object value) { empty.setAttribute(name, value); } | setAttribute |
17,212 | Set<String> () { return empty.getAttributeNames(); } | getAttributeNames |
17,213 | Object (String name) { return empty.removeAttribute(name); } | removeAttribute |
17,214 | ITestContext () { return empty.getTestContext(); } | getTestContext |
17,215 | void (ITestContext context) { empty.setContext(context); } | setContext |
17,216 | int (ITestResult comparison) { return empty.compareTo(comparison); } | compareTo |
17,217 | String () { return empty.getInstanceName(); } | getInstanceName |
17,218 | void (String name) { empty.setTestName(name); } | setTestName |
17,219 | int () { return empty.getParameterIndex(); } | getParameterIndex |
17,220 | boolean () { return empty.wasRetried(); } | wasRetried |
17,221 | void (boolean wasRetried) { empty.setWasRetried(wasRetried); } | setWasRetried |
17,222 | List<ITestNGMethod> () { return empty.getSkipCausedBy(); } | getSkipCausedBy |
17,223 | boolean (ITestResult result) { return ITestResult.wasFailureDueToTimeout(result); } | wasFailureDueToTimeout |
17,224 | void () { PsiClass aClass = myFixture.addClass("package a; /** @noinspection ALL*/ @org.testng.annotations.Test public class MyTestClass {void testOne(){}}"); assertFalse(new TestNGFramework().isTestMethod(aClass.getMethods()[0], false)); } | testPackagePrivateMethodWhenAnnotationIsOnClass |
17,225 | void () { PsiClass aClass = myFixture.addClass("package a; @org.testng.annotations.Test " + "public class MyTestClass {" + "public MyTetClass(String defaultName){}\n" + " public void testOne(){}" + "}"); Project project = getProject(); TestClassFilter classFilter = new TestClassFilter(GlobalSearchScope.projectScope(project), project, false, true); assertTrue(classFilter.isAccepted(aClass)); } | testClassWithSingleParameterConstructor |
17,226 | void () {} | testTwo |
17,227 | void () {} | testOne |
17,228 | void () {} | testTwo |
17,229 | void () {} | testOne |
17,230 | void () {} | testForth |
17,231 | void () {} | testOne |
17,232 | void () {} | testTwo |
17,233 | void () { final PsiClass aClass = myFixture.addClass("package a; public class ATest {" + " @org.testng.annotations.Test()\n" + " public void testTwo(){}\n " + " @org.testng.annotations.Test(dependsOnMethods = \"testTwo\")\n" + " public void testOne(String s){}\n" + //parameterized "}"); final LinkedHashMap<PsiClass, Map<PsiMethod, List<String>>> classes = new LinkedHashMap<>(); classes.put(aClass, new HashMap<>()); final GlobalSearchScope projectScope = GlobalSearchScope.projectScope(getProject()); final SMTestProxy testProxy = new SMTestProxy("testOne", false, "java:test://a.ATest.testOne[a]"); testProxy.setLocator(new JavaTestLocator()); RerunFailedTestsAction.includeFailedTestWithDependencies(classes, projectScope, getProject(), testProxy); assertEquals(1, classes.size()); final Map<PsiMethod, List<String>> params = classes.get(aClass); assertContainsElements(params.keySet(), aClass.getMethods()); final List<String> paramsToRerun = params.get(aClass.findMethodsByName("testOne", false)[0]); assertEquals(1, paramsToRerun.size()); assertContainsElements(paramsToRerun, "a"); } | testRerunFailedTestWithDependency |
17,234 | void () { @SuppressWarnings("TestNGDataProvider") final PsiClass aClass = myFixture.addClass(""" package a; import org.testng.annotations.DataProvider; import org.testng.annotations.Test; import static org.testng.Assert.assertEquals; public class ATest { @DataProvider public Object[][] testData() { return new Object[][]{ {1}, {2}, }; } @Test(dataProvider = "testData") public void test(int in) { assertEquals(in, 0); } } """); final LinkedHashMap<PsiClass, Map<PsiMethod, List<String>>> classes = new LinkedHashMap<>(); classes.put(aClass, new HashMap<>()); final GlobalSearchScope projectScope = GlobalSearchScope.projectScope(getProject()); final SMTestProxy testProxy = new SMTestProxy("test", false, "java:test://a.ATest.test[0]"); testProxy.setLocator(new JavaTestLocator()); RerunFailedTestsAction.includeFailedTestWithDependencies(classes, projectScope, getProject(), testProxy); final SMTestProxy testProxy2 = new SMTestProxy("test", false, "java:test://a.ATest.test[1]"); testProxy2.setLocator(new JavaTestLocator()); RerunFailedTestsAction.includeFailedTestWithDependencies(classes, projectScope, getProject(), testProxy2); assertEquals(1, classes.size()); final Map<PsiMethod, List<String>> params = classes.get(aClass); final PsiMethod[] tests = aClass.findMethodsByName("test", false); assertContainsElements(params.keySet(), tests); final List<String> paramsToRerun = params.get(tests[0]); assertEquals(2, paramsToRerun.size()); assertContainsElements(paramsToRerun, "0", "1"); } | testRerunFailedParameterized |
17,235 | Object[][] () { return new Object[][]{ {1}, {2}, }; } | testData |
17,236 | void (int in) { assertEquals(in, 0); } | test |
17,237 | void () { UIUtil.invokeAndWaitIfNeeded(() -> { try { myProjectFixture.tearDown(); myProjectFixture = null; myFixture.tearDown(); myFixture = null; } catch (Exception e) { throw new RuntimeException(e); } }); } | tearDown |
17,238 | void () { final Project project = myProjectFixture.getProject(); final PsiClass psiClass = findTestClass(project); final TestNGConfiguration configuration = createConfiguration(project); configuration.beClassConfiguration(psiClass); final String newName = "Testt1"; final RenameRefactoring renameClass = RefactoringFactory.getInstance(project).createRename(psiClass, newName); renameClass.setSearchInComments(false); renameClass.setSearchInNonJavaFiles(false); WriteCommandAction.runWriteCommandAction(project, () -> renameClass.run()); Assert.assertEquals(newName, configuration.getPersistantData().getMainClassName()); final PsiMethod notATestMethod = findNotATestMethod(psiClass); final RenameRefactoring renameNotATestMethod = RefactoringFactory.getInstance(project).createRename(notATestMethod, "aaaa"); renameNotATestMethod.setSearchInComments(false); renameNotATestMethod.setSearchInNonJavaFiles(false); WriteCommandAction.runWriteCommandAction(project, () -> renameNotATestMethod.run()); Assert.assertEquals(configuration.getPersistantData().getMainClassName(), newName); Assert.assertEquals(configuration.getPersistantData().getMethodName(), ""); Assert.assertEquals(configuration.getPersistantData().TEST_OBJECT, TestType.CLASS.getType()); } | testClassRename |
17,239 | void () { final Project project = myProjectFixture.getProject(); final PsiClass psiClass = findTestClass(project); final String className = psiClass.getName(); final TestNGConfiguration configuration = createConfiguration(project); final PsiMethod method = findTestMethod(psiClass); configuration.beMethodConfiguration(new PsiLocation<>(project, method)); final String newMethodName = "renamedTest"; final RenameRefactoring renameMethod = RefactoringFactory.getInstance(project).createRename(method, newMethodName); renameMethod.setSearchInComments(false); renameMethod.setSearchInNonJavaFiles(false); WriteCommandAction.runWriteCommandAction(project, () -> renameMethod.run()); Assert.assertEquals(className, configuration.getPersistantData().getMainClassName()); Assert.assertEquals(newMethodName, configuration.getPersistantData().getMethodName()); final PsiMethod notATestMethod = findNotATestMethod(psiClass); final RenameRefactoring renameNotATestMethod1 = RefactoringFactory.getInstance(project).createRename(notATestMethod, "bbbbb"); renameNotATestMethod1.setSearchInComments(false); renameNotATestMethod1.setSearchInNonJavaFiles(false); WriteCommandAction.runWriteCommandAction(project, () -> renameNotATestMethod1.run()); Assert.assertEquals(className, configuration.getPersistantData().getMainClassName()); Assert.assertEquals(newMethodName, configuration.getPersistantData().getMethodName()); } | testRenameMethod |
17,240 | PsiMethod (final PsiClass psiClass) { final PsiMethod[] psiMethods = psiClass.findMethodsByName("test", false); assert psiMethods.length == 1; return psiMethods[0]; } | findTestMethod |
17,241 | void () { final Project project = myProjectFixture.getProject(); final PsiClass psiClass = findTestClass(project); final TestNGConfiguration configuration = createConfiguration(project); final TestNGConfigurationType type = TestNGConfigurationType.getInstance(); //class config configuration.beClassConfiguration(psiClass); PsiMethod testMethod = findTestMethod(psiClass); Assert.assertTrue(type.isConfigurationByLocation(configuration, new PsiLocation(project, psiClass))); Assert.assertFalse(type.isConfigurationByLocation(configuration, new PsiLocation(project, testMethod))); //method config configuration.beMethodConfiguration(new PsiLocation<>(project, testMethod)); Assert.assertTrue(type.isConfigurationByLocation(configuration, new PsiLocation(project, testMethod))); Assert.assertFalse(type.isConfigurationByLocation(configuration, new PsiLocation(project, psiClass))); } | testReuseOrCreateNewConfiguration |
17,242 | void () { final Project project = myProjectFixture.getProject(); final PsiClass psiClass = findTestClass(project); final TestNGInClassConfigurationProducer producer = new TestNGInClassConfigurationProducer(); final MapDataContext dataContext = new MapDataContext(); dataContext.put(CommonDataKeys.PROJECT, project); dataContext.put(PlatformCoreDataKeys.MODULE, ModuleUtilCore.findModuleForPsiElement(psiClass)); dataContext.put(Location.DATA_KEY, PsiLocation.fromPsiElement(psiClass)); final ConfigurationFromContext fromContext = producer.createConfigurationFromContext(ConfigurationContext.getFromContext(dataContext, ActionPlaces.UNKNOWN)); assert fromContext != null; final RunnerAndConfigurationSettings config = fromContext.getConfigurationSettings(); final RunConfiguration runConfiguration = config.getConfiguration(); Assert.assertTrue(runConfiguration instanceof TestNGConfiguration); TestNGConfigurationType t = (TestNGConfigurationType)runConfiguration.getType(); Assert.assertTrue(t.isConfigurationByLocation(runConfiguration, new PsiLocation(project, psiClass))); } | testCreateFromContext |
17,243 | PsiClass (final Project project) { final PsiClass psiClass = JavaPsiFacade.getInstance(project).findClass("Testt", GlobalSearchScope.allScope(project)); assert psiClass != null; return psiClass; } | findTestClass |
17,244 | PsiMethod (final PsiClass psiClass) { final PsiMethod[] notATestMethods = psiClass.findMethodsByName("notATest", false); assert notATestMethods.length == 1; return notATestMethods[0]; } | findNotATestMethod |
17,245 | TestNGConfiguration (final Project project) { final RunManager manager = RunManager.getInstance(project); RunnerAndConfigurationSettings settings = manager.createConfiguration("testt", TestNGConfigurationType.class); manager.addConfiguration(settings); return (TestNGConfiguration)settings.getConfiguration(); } | createConfiguration |
17,246 | void () { myFixture.testHighlighting(true, false, false, "Simple.java"); } | testSimple |
17,247 | void () { myFixture.testHighlighting(true, false, false, "ArrayInitializerMemberValue.java"); } | testArrayInitializerMemberValue |
17,248 | String () { return PluginPathManager.getPluginHomePath("testng") + "/testData/inspection/expected_exception_never_thrown/"; } | getTestDataPath |
17,249 | void () { myFixture.enableInspections(AssertWithoutMessageInspection.class); myFixture.testHighlighting("AssertsWithoutMessages.java"); } | testInspection |
17,250 | void () { myFixture.configureByText(JavaFileType.INSTANCE, """ import org.testng.annotations.Test; import static org.testng.Assert.*; class TestCase { @Test public void test() { <warning descr="'assertEquals()' without message"><caret>assertEquals</warning>(1, 1); } }"""); myFixture.enableInspections(AssertWithoutMessageInspection.class); myFixture.testHighlighting(true, false, false); final IntentionAction intention = myFixture.getAvailableIntention("Add error message"); assertNotNull(intention); myFixture.launchAction(intention); NonBlockingReadActionImpl.waitForAsyncTaskCompletion(); myFixture.checkResult(""" import org.testng.annotations.Test; import static org.testng.Assert.*; class TestCase { @Test public void test() { assertEquals(1, 1, "<caret>"); } }"""); } | testQuickFix |
17,251 | void () { <warning descr="'assertEquals()' without message"><caret>assertEquals</warning>(1, 1); } | test |
17,252 | void () { assertEquals(1, 1, "<caret>"); } | test |
17,253 | void (JavaModuleFixtureBuilder moduleBuilder) { moduleBuilder.addLibrary("testng", PathUtil.getJarPathForClass(DataProvider.class)); } | tuneFixture |
17,254 | String () { return PluginPathManager.getPluginHomePath("testng") + "/testData/inspection/asserts_without_messages/"; } | getTestDataPath |
17,255 | void (JavaModuleFixtureBuilder moduleBuilder) { moduleBuilder.setMockJdkLevel(JavaModuleFixtureBuilder.MockJdkLevel.jdk15); moduleBuilder.addLibrary("junit", PathUtil.getJarPathForClass(TestCase.class)); moduleBuilder.addLibrary("testng", PathUtil.getJarPathForClass(AfterMethod.class)); } | tuneFixture |
17,256 | void () { final String testName = getTestName(false); IntentionAction resultAction = getAction(); myFixture.launchAction(resultAction); myFixture.checkResultByFile(AFTER + testName + ".java"); } | doTest |
17,257 | void () { final String testName = getTestName(false); IntentionAction resultAction = getAction(); myFixture.checkPreviewAndLaunchAction(resultAction); myFixture.checkResultByFile(AFTER + testName + ".java"); } | doTestWithPreview |
17,258 | IntentionAction () { IntentionAction resultAction = null; final String testName = getTestName(false); final String resultActionName = getActionName(); for (IntentionAction action : myFixture.getAvailableIntentions(BEFORE + testName + ".java")) { if (Comparing.strEqual(action.getText(), resultActionName)) { resultAction = action; break; } } Assert.assertNotNull(resultAction, "action isn't found"); return resultAction; } | getAction |
17,259 | String () { return getEnabledTool().getDisplayName(); } | getActionName |
17,260 | void () { myFixture.enableInspections(DuplicatedDataProviderNamesInspection.class); myFixture.testHighlighting("duplicatedDataProviders.java"); } | testInspection |
17,261 | void (JavaModuleFixtureBuilder moduleBuilder) { moduleBuilder.addLibrary("testng", PathUtil.getJarPathForClass(DataProvider.class)); } | tuneFixture |
17,262 | String () { return PluginPathManager.getPluginHomePath("testng") + "/testData/inspection/"; } | getTestDataPath |
17,263 | LocalInspectionTool () { return new ConvertOldAnnotationInspection(); } | getEnabledTool |
17,264 | String () { return "Convert old @Configuration TestNG annotations"; } | getActionName |
17,265 | String () { return PluginPathManager.getPluginHomePathRelative("testng") + "/testData/configuration"; } | getBasePath |
17,266 | void () { doTestWithPreview(); } | test1 |
17,267 | String () { return "test"; } | getName |
17,268 | void () { UIUtil.invokeAndWaitIfNeeded(() -> { try { UndeclaredTestsInspectionTest.super.setUp(); } catch (Exception e) { throw new RuntimeException(e); } }); } | setUp |
17,269 | void () { UIUtil.invokeAndWaitIfNeeded(() -> { try { UndeclaredTestsInspectionTest.super.tearDown(); } catch (Exception e) { throw new RuntimeException(e); } }); } | tearDown |
17,270 | String () { return PluginPathManager.getPluginHomePath("testng") + "/testData/inspection"; } | getTestDataPath |
17,271 | Object[][] () { return new Object[][]{{"declared"}, {"undeclared"}, {"packageDeclared"}, {"inSubPackage"}, {"incorrectSubPackage"}, {"packageNonDeclared"}, {"commented"}, {"commented1"}}; } | data |
17,272 | void (final String name) { UIUtil.invokeAndWaitIfNeeded(() -> { try { TestNGUtil.hasDocTagsSupport = true; doTest("undeclaredTests/" + name, new UndeclaredTestInspection()); } catch (Exception e) { throw new RuntimeException(e); } }); } | doTest |
17,273 | void () {} | test |
17,274 | LocalInspectionTool () { return new JUnitConvertTool(); } | getEnabledTool |
17,275 | String () { return "Convert TestCase to TestNG"; } | getActionName |
17,276 | void () { doTestWithPreview(); } | testClass |
17,277 | void () { doTestWithPreview(); } | testFail |
17,278 | void () { doTestWithPreview(); } | testUnaryAssertions |
17,279 | void () { doTestWithPreview(); } | testBinaryAssertions |
17,280 | void () { doTestWithPreview(); } | testIncompatible |
17,281 | void () { doTestWithPreview(); } | testDelta |
17,282 | String () { return PluginPathManager.getPluginHomePathRelative("testng") + "/testData/junit"; } | getBasePath |
17,283 | void () { myFixture.testHighlighting(true, false, false, "MissedDataProvider.java"); } | testMissedDataProvider |
17,284 | void () { myFixture.testHighlighting(true, false, false, "InstanceDataProviderFromForeignClass.java"); } | testInstanceDataProviderFromForeignClass |
17,285 | String () { return PluginPathManager.getPluginHomePath("testng") + "/testData/inspection/dataProvider/"; } | getTestDataPath |
17,286 | void () { doTestWithPreview(); } | test1 |
17,287 | void () { doTestWithPreview(); } | test2 |
17,288 | void () { doTestWithPreview(); } | test3 |
17,289 | String () { return "Convert TestNG Javadoc to 1.5 annotations"; } | getActionName |
17,290 | String () { return PluginPathManager.getPluginHomePathRelative("testng") + "/testData/javadoc2Annotation"; } | getBasePath |
17,291 | LocalInspectionTool () { return new ConvertJavadocInspection(); } | getEnabledTool |
17,292 | void () { myFixture.enableInspections(DataProviderReturnTypeInspection.class); myFixture.testHighlighting("dataProviderReturnType.java"); } | testInspection |
17,293 | void (JavaModuleFixtureBuilder moduleBuilder) { moduleBuilder.addLibrary("testng", PathUtil.getJarPathForClass(DataProvider.class)); } | tuneFixture |
17,294 | String () { return PluginPathManager.getPluginHomePath("testng") + "/testData/inspection/"; } | getTestDataPath |
17,295 | void () { Runnable runnable = () -> { myFixture.addClass("package org.testng.annotations;\n" + "public @interface AfterSuite { java.lang.String[] dependsOnMethods() default {};}"); myFixture.addClass("package org.testng.annotations;\n" + "public @interface BeforeMethod { java.lang.String[] dependsOnMethods() default {};}"); myFixture.addClass("package org.testng.annotations;\n" + "public @interface Test { java.lang.String[] dependsOnMethods() default {};}"); myFixture.testHighlighting(true, false, false, "Dependencies.java"); }; UIUtil.invokeAndWaitIfNeeded(runnable); } | testDependencies |
17,296 | void () {} | testNothing |
17,297 | String () { return PluginPathManager.getPluginHomePath("testng") + "/testData/inspection/dependsOn/"; } | getTestDataPath |
17,298 | void () { UIUtil.invokeAndWaitIfNeeded(() -> { try { TestNGDependsOnInspectionTest.super.setUp(); myFixture.enableInspections(new DependsOnMethodInspection()); } catch (Exception e) { throw new RuntimeException(e); } }); } | setUp |
17,299 | void () { UIUtil.invokeAndWaitIfNeeded(() -> { try { TestNGDependsOnInspectionTest.super.tearDown(); } catch (Exception e) { throw new RuntimeException(e); } }); } | tearDown |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.