Unnamed: 0
int64
0
305k
body
stringlengths
7
52.9k
name
stringlengths
1
185
17,100
Object[][] () {return null;}
someTestData
17,101
Object[][] () {return null;}
someTestData2
17,102
Object[][] () {return null;}
someTestData
17,103
Object[][] () {return null;}
someTestData2
17,104
Object[][] () {return null;}
someTestData2
17,105
Object[][] () {return null;}
getData
17,106
Object[][] () { return null; }
someTestData
17,107
Object[] () { return null; }
someTestData5
17,108
String[][] () { return null; }
someTestData6
17,109
Iterator<Object[]> () { return null; }
someTestData2
17,110
Iterator<Object> () { return null; }
someTestData3
17,111
Iterator<String[]> () { return null; }
someTestData4
17,112
Object[][][][] () { return new Sample[][][][] { { new Sample[0][], new Sample[0][] }, { new Sample[0][], new Sample[][]{} }, }; }
createData1
17,113
Sample[][][][] () { return new Sample[][][][] { { new Sample[0][], new Sample[0][] }, { new Sample[0][], new Sample[][]{} }, }; }
createData2
17,114
void () { }
f
17,115
void () { }
f
17,116
void () { }
f
17,117
void () { }
f
17,118
void () { }
f
17,119
void () { }
f
17,120
void () { }
f
17,121
void () { }
f
17,122
void () { }
test
17,123
Object[][] () {return null;}
data
17,124
void () { }
test
17,125
void () {}
testBar
17,126
void () {}
testBar2
17,127
void () {}
testBar1
17,128
void () { <warning descr="'assertEquals()' without message">assertEquals</warning>("asdf", Integer.valueOf(1)); <warning descr="'assertEquals()' without message">assertEquals</warning>(Double.valueOf(2.0), 1, 0.1); <warning descr="'assertEquals()' without message">assertEquals</warning>(new Object[1], new Object[2]); <warning descr="'assertFalse()' without message">assertFalse</warning>(false); AssertJUnit.<warning descr="'assertEquals()' without message">assertEquals</warning>(new Object[1], new Object[2]); int i = 2; AssertJUnit.assertEquals("asdf", 0, i); AssertJUnit.fail("hello!"); fail("bla", new RuntimeException()); <warning descr="'fail()' without message">fail</warning>(); }
bla
17,129
void () { }
exceptionTestOne
17,130
void () { }
exceptionTestOne
17,131
void () {}
test
17,132
void () {}
notATest
17,133
void () { assertArrayEquals("message", new double[0], true ? new double[0] : null, 0d); assertArrayEquals(new double[0], true ? new double[0] : null, 0d); assertEquals("message", 0d, 1d, 2d); assertEquals(1d, 2d, 0d); }
differentAssertions
17,134
void () { org.hamcrest.MatcherAssert.assertThat(1, Matchers.is(1)); org.hamcrest.MatcherAssert.assertThat("reason", 1, Matchers.is(1)); }
differentAssertions
17,135
void () { assertEquals("1", "2", "description"); assertNotNull(""); assertFalse(false); assertTrue("true", true); assertNotSame("not same", "1", "2"); assertNull(null); assertNull("description", null); assertSame("description", "1", "2"); fail("fail"); }
test
17,136
void () { AssertJUnit.assertArrayEquals("message", new double[0], true ? new double[0] : null, 0d); AssertJUnit.assertArrayEquals(new double[0], true ? new double[0] : null, 0d); AssertJUnit.assertEquals("message", 0d, 1d, 2d); AssertJUnit.assertEquals(1d, 2d, 0d); }
differentAssertions
17,137
void () { Assert.assertEquals("description", "2", "1"); Assert.assertNotNull(""); Assert.assertFalse(false); Assert.assertTrue(true, "true"); Assert.assertNotSame("2", "1", "not same"); Assert.assertNull(null); Assert.assertNull(null, "description"); Assert.assertSame("2", "1", "description"); Assert.fail("fail"); }
test
17,138
void () { assertTrue("message", true); assertTrue(true); assertFalse("message", false); assertFalse(false); assertNotNull("message", new Object()); assertNotNull(new Object()); assertNull("message", null); assertNull(null); }
differentAssertions
17,139
void () { Assert.assertEquals(true ? new Integer(1) : null, new Integer(1), "message"); Assert.assertEquals(true ? new Integer(1) : null, new Integer(1)); Assert.assertNotEquals(new Integer(2), new Integer(1), "message"); Assert.assertNotEquals(new Integer(2), new Integer(1)); Assert.assertEquals(true ? new long[0] : null, new long[0], "message"); Assert.assertEquals(true ? new long[0] : null, new long[0]); Assert.assertEquals(true ? 1L : 0, 1L); Assert.assertEquals(true ? 1L : 0, 1L, "message"); Assert.assertSame(true ? Integer.valueOf(1) : null, (Object) Integer.valueOf(1), "message"); Assert.assertSame(true ? Integer.valueOf(1) : null, (Object) Integer.valueOf(1)); Assert.assertNotSame(true ? new Object() : null, new Object(), "message"); Assert.assertNotSame(true ? new Object() : null, new Object()); Assert.assertEquals(true ? new Object[0] : null, new Object[0], "message"); Assert.assertEquals(true ? new Object[0] : null, new Object[0]); }
differentAssertions
17,140
void () { //do smth }
test
17,141
void () { assertThat(1, Matchers.is(1)); assertThat("reason", 1, Matchers.is(1)); }
differentAssertions
17,142
void () { Assert.assertTrue(true, "message"); Assert.assertTrue(true); Assert.assertFalse(false, "message"); Assert.assertFalse(false); Assert.assertNotNull(new Object(), "message"); Assert.assertNotNull(new Object()); Assert.assertNull(null, "message"); Assert.assertNull(null); }
differentAssertions
17,143
void () { assertEquals("message", new Integer(1), true ? new Integer(1) : null); assertEquals(new Integer(1), true ? new Integer(1) : null); assertNotEquals("message", new Integer(1), new Integer(2)); assertNotEquals(new Integer(1), new Integer(2)); assertArrayEquals("message", new long[0], true ? new long[0] : null); assertArrayEquals(new long[0], true ? new long[0] : null); assertEquals(1L, true ? 1L : 0); assertEquals("message", 1L, true ? 1L : 0); assertSame("message", (Object) Integer.valueOf(1), true ? Integer.valueOf(1) : null); assertSame((Object) Integer.valueOf(1), true ? Integer.valueOf(1) : null); assertNotSame("message", new Object(), true ? new Object() : null); assertNotSame(new Object(), true ? new Object() : null); assertEquals("message", new Object[0], true ? new Object[0] : null); assertEquals(new Object[0], true ? new Object[0] : null); }
differentAssertions
17,144
void () { //do smth }
test
17,145
void () { UIUtil.invokeAndWaitIfNeeded(() -> { try { TestNGDataProviderTest.super.setUp(); } catch (Exception e) { throw new RuntimeException(e); } }); }
setUp
17,146
void () { UIUtil.invokeAndWaitIfNeeded(() -> { try { TestNGDataProviderTest.super.tearDown(); } catch (Exception e) { throw new RuntimeException(e); } }); }
tearDown
17,147
Object[][] () { return new Object[][]{ new Object[]{"private", new String[]{"data"}}, new Object[]{"privateinsuper", ArrayUtilRt.EMPTY_STRING_ARRAY}, new Object[]{"protectedinsuper", new String[]{"data"}}, new Object[]{"privateindataproviderclass", new String[]{"data"}}, }; }
data
17,148
void () {}
testNothing
17,149
void (final String path, final String... results) { UIUtil.invokeAndWaitIfNeeded(() -> { try { myFixture.addClass("package org.testng.annotations; public @interface DataProvider {}"); myFixture.addClass("package org.testng.annotations; public @interface Test {}"); myFixture.testCompletionVariants(path + "provider.java", results); } catch (Exception e) { throw new RuntimeException(e); } }); }
checkDataProviders
17,150
String () { return PluginPathManager.getPluginHomePathRelative("testng") + "/testData/references"; }
getBasePath
17,151
void () { UIUtil.invokeAndWaitIfNeeded(() -> { try { TestNGSuiteTest.super.setUp(); } catch (Exception e) { throw new RuntimeException(e); } }); }
setUp
17,152
void () { UIUtil.invokeAndWaitIfNeeded(() -> { try { TestNGSuiteTest.super.tearDown(); } catch (Exception e) { throw new RuntimeException(e); } }); }
tearDown
17,153
void () {}
testNothing
17,154
void () { UIUtil.invokeAndWaitIfNeeded(() -> { try { myFixture.addClass("package org.testng.annotations; public @interface DataProvider {}"); myFixture.addClass("package org.testng.annotations; public @interface Test {}"); myFixture.addClass("package o; @Test public class MyTest { public void testMe(){} }"); myFixture.addFileToProject("subPack/test-unit.xml", "<suite>" + "<test>" + "<classes></classes>" + "</test>" + "</suite>"); myFixture.enableInspections(new XmlPathReferenceInspection()); myFixture.testHighlighting("testng.xml"); } catch (Exception e) { throw new RuntimeException(e); } }); }
testTestNGSuiteFile
17,155
String () { return PluginPathManager.getPluginHomePathRelative("testng") + "/testData/references"; }
getBasePath
17,156
void () { final XmlSuite suite = new XmlSuite(); final XmlTest test = new XmlTest(); final XmlClass xmlClass = new XmlClass("a.ATest", false); xmlClass.getIncludedMethods().add(new XmlInclude("test1")); test.getClasses().add(xmlClass); suite.getTests().add(test); doTest(suite, """ ##teamcity[enteredTheMatrix] ##teamcity[testSuiteStarted name ='ATest' locationHint = 'java:suite://a.ATest'] ##teamcity[testStarted name='ATest.test1|[0|]' locationHint='java:test://a.ATest/test1'] ##teamcity[testFinished name='ATest.test1|[0|]'] """); }
testOneTestMethod
17,157
void () { final StringBuffer buf = new StringBuffer(); final IDEATestNGRemoteListener listener = createListener(buf); listener.onStart((ISuite)null); listener.onTestSkipped(new MockTestNGResult("ATest", "testName")); listener.onFinish((ISuite)null); Assert.assertEquals("output: " + buf, """ ##teamcity[enteredTheMatrix] ##teamcity[testSuiteStarted name ='ATest' locationHint = 'java:suite://ATest'] ##teamcity[testStarted name='ATest.testName' locationHint='java:test://ATest/testName'] ##teamcity[testIgnored name='ATest.testName'] ##teamcity[testFinished name='ATest.testName'] ##teamcity[testSuiteFinished name='ATest'] """, StringUtil.convertLineSeparators(buf.toString())); }
testSkipTestMethod
17,158
void () { final StringBuffer buf = new StringBuffer(); final IDEATestNGRemoteListener listener = createListener(buf); listener.onStart((ISuite)null); final MockTestNGResult[] results = new MockTestNGResult[] {new MockTestNGResult("ATest", "testName"), new MockTestNGResult("ATest", "testName1"), new MockTestNGResult("ATest", "testName")}; for (MockTestNGResult result : results) { listener.onTestStart(result); listener.onTestFinished(result); } listener.onFinish((ISuite)null); Assert.assertEquals("output: " + buf, """ ##teamcity[enteredTheMatrix] ##teamcity[testSuiteStarted name ='ATest' locationHint = 'java:suite://ATest'] ##teamcity[testStarted name='ATest.testName' locationHint='java:test://ATest/testName'] ##teamcity[testFinished name='ATest.testName'] ##teamcity[testStarted name='ATest.testName1' locationHint='java:test://ATest/testName1'] ##teamcity[testFinished name='ATest.testName1'] ##teamcity[testStarted name='ATest.testName (1)' locationHint='java:test://ATest/testName|[1|]'] ##teamcity[testFinished name='ATest.testName (1)'] ##teamcity[testSuiteFinished name='ATest'] """, StringUtil.convertLineSeparators(buf.toString())); }
testParallelTestExecutionPreserveInvocationCount
17,159
void () { final StringBuffer buf = new StringBuffer(); final IDEATestNGRemoteListener listener = createListener(buf); listener.onStart((ISuite)null); final MockTestNGResult[] results = new MockTestNGResult[] {new MockTestNGResult("ATest", "testName"), new MockTestNGResult("BTest", "testName")}; for (MockTestNGResult result : results) { listener.onTestStart(result); } for (MockTestNGResult result : results) { listener.onTestFinished(result); } listener.onFinish((ISuite)null); Assert.assertEquals("output: " + buf, """ ##teamcity[enteredTheMatrix] ##teamcity[testSuiteStarted name ='ATest' locationHint = 'java:suite://ATest'] ##teamcity[testStarted name='ATest.testName' locationHint='java:test://ATest/testName'] ##teamcity[testSuiteFinished name='ATest'] ##teamcity[testSuiteStarted name ='BTest' locationHint = 'java:suite://BTest'] ##teamcity[testStarted name='BTest.testName' locationHint='java:test://BTest/testName'] ##teamcity[testFinished name='ATest.testName'] ##teamcity[testFinished name='BTest.testName'] ##teamcity[testSuiteFinished name='BTest'] """, StringUtil.convertLineSeparators(buf.toString())); }
testParallelSameNameTestExecution
17,160
void () { final StringBuffer buf = new StringBuffer(); final IDEATestNGRemoteListener listener = createListener(buf); listener.onStart((ISuite)null); listener.onTestFailure(new MockTestNGResult("ATest", "testName", createExceptionWithoutTrace(), ArrayUtilRt.EMPTY_OBJECT_ARRAY)); listener.onFinish((ISuite)null); Assert.assertEquals("output: " + buf, """ ##teamcity[enteredTheMatrix] ##teamcity[testSuiteStarted name ='ATest' locationHint = 'java:suite://ATest'] ##teamcity[testStarted name='ATest.testName' locationHint='java:test://ATest/testName'] ##teamcity[testFailed name='ATest.testName' error='true' message='' details='java.lang.Exception|n'] ##teamcity[testFinished name='ATest.testName'] ##teamcity[testSuiteFinished name='ATest'] """, StringUtil.convertLineSeparators(buf.toString())); }
testFailureWithoutStart
17,161
void () { final StringBuffer buf = new StringBuffer(); final IDEATestNGRemoteListener listener = createListener(buf); listener.onStart((ISuite)null); final MockTestNGResult result = new MockTestNGResult("ATest", "testName"); listener.onTestStart(result); listener.onTestSkipped(result); listener.onFinish((ISuite)null); Assert.assertEquals("output: " + buf, """ ##teamcity[enteredTheMatrix] ##teamcity[testSuiteStarted name ='ATest' locationHint = 'java:suite://ATest'] ##teamcity[testStarted name='ATest.testName' locationHint='java:test://ATest/testName'] ##teamcity[testIgnored name='ATest.testName'] ##teamcity[testFinished name='ATest.testName'] ##teamcity[testSuiteFinished name='ATest'] """, StringUtil.convertLineSeparators(buf.toString())); }
testSkipMethodAfterStartTest
17,162
void () { final XmlSuite suite = new XmlSuite(); final XmlTest test = new XmlTest(); final XmlClass xmlClass = new XmlClass("a.ATest", false); xmlClass.getIncludedMethods().add(new XmlInclude("test1", Arrays.asList(0, 1, 2), 0)); test.getClasses().add(xmlClass); suite.getTests().add(test); doTest(suite, """ ##teamcity[enteredTheMatrix] ##teamcity[testSuiteStarted name ='ATest' locationHint = 'java:suite://a.ATest'] ##teamcity[testStarted name='ATest.test1|[0|]' locationHint='java:test://a.ATest/test1'] ##teamcity[testFinished name='ATest.test1|[0|]'] ##teamcity[testStarted name='ATest.test1|[1|] (1)' locationHint='java:test://a.ATest/test1|[1|]'] ##teamcity[testFinished name='ATest.test1|[1|] (1)'] ##teamcity[testStarted name='ATest.test1|[2|] (2)' locationHint='java:test://a.ATest/test1|[2|]'] ##teamcity[testFinished name='ATest.test1|[2|] (2)'] """); }
testOneTestMethodWithMultipleInvocationCount
17,163
void () { final StringBuffer buf = new StringBuffer(); final IDEATestNGRemoteListener listener = createListener(buf); final String className = "a.ATest"; listener.onSuiteStart(className, true); for(String methodName : new String[] {"test1", "test2"}) { final MockTestNGResult setUp = new MockTestNGResult(className, "setUp"); listener.onConfigurationStart(setUp); listener.onConfigurationSuccess(setUp); final MockTestNGResult result = new MockTestNGResult(className, methodName); listener.onTestStart(result); listener.onTestFinished(result); final MockTestNGResult tearDown = new MockTestNGResult(className, "tearDown"); listener.onConfigurationStart(tearDown); listener.onConfigurationSuccess(tearDown); } listener.onSuiteFinish(className); Assert.assertEquals("output: " + buf, """ ##teamcity[enteredTheMatrix] ##teamcity[testSuiteStarted name ='ATest' locationHint = 'java:suite://a.ATest'] ##teamcity[testStarted name='ATest.setUp' locationHint='java:test://a.ATest/setUp' config='true'] ##teamcity[testFinished name='ATest.setUp'] ##teamcity[testStarted name='ATest.test1' locationHint='java:test://a.ATest/test1'] ##teamcity[testFinished name='ATest.test1'] ##teamcity[testStarted name='ATest.tearDown' locationHint='java:test://a.ATest/tearDown' config='true'] ##teamcity[testFinished name='ATest.tearDown'] ##teamcity[testStarted name='ATest.setUp (1)' locationHint='java:test://a.ATest/setUp|[1|]' config='true'] ##teamcity[testFinished name='ATest.setUp (1)'] ##teamcity[testStarted name='ATest.test2' locationHint='java:test://a.ATest/test2'] ##teamcity[testFinished name='ATest.test2'] ##teamcity[testStarted name='ATest.tearDown (1)' locationHint='java:test://a.ATest/tearDown|[1|]' config='true'] ##teamcity[testFinished name='ATest.tearDown (1)'] ##teamcity[testSuiteFinished name='a.ATest'] """, StringUtil.convertLineSeparators(buf.toString())); }
testConfigurationMethods
17,164
void () { final StringBuffer buf = new StringBuffer(); final IDEATestNGRemoteListener listener = createListener(buf); final String className = "a.ATest"; listener.onSuiteStart(className, true); final MockTestNGResult setUp = new MockTestNGResult(className, "setUp", createExceptionWithoutTrace(), ArrayUtilRt.EMPTY_OBJECT_ARRAY); listener.onConfigurationStart(setUp); listener.onConfigurationFailure(setUp); listener.onSuiteFinish(className); Assert.assertEquals("output: " + buf, """ ##teamcity[enteredTheMatrix] ##teamcity[testSuiteStarted name ='ATest' locationHint = 'java:suite://a.ATest'] ##teamcity[testStarted name='ATest.setUp' locationHint='java:test://a.ATest/setUp' config='true'] ##teamcity[testFailed name='ATest.setUp' error='true' message='' details='java.lang.Exception|n'] ##teamcity[testFinished name='ATest.setUp'] ##teamcity[testSuiteFinished name='a.ATest'] """, StringUtil.convertLineSeparators(buf.toString())); }
testConfigurationFailure
17,165
void () { final StringBuffer buf = new StringBuffer(); final IDEATestNGRemoteListener listener = createListener(buf); final String className = "a.ATest"; AssertionError throwable = new AssertionError("expected [expected\nnewline] but found [actual\nnewline]"); MockTestNGResult foo = new MockTestNGResult(className, "testFoo", throwable, ArrayUtil.EMPTY_OBJECT_ARRAY); listener.onTestFailure(foo); String message = buf.toString(); String expectedFailureMessage = "##teamcity[testFailed name='ATest.testFoo' message='java.lang.AssertionError:' expected='expected|nnewline' actual='actual|nnewline'"; Assert.assertTrue(message, message.contains(expectedFailureMessage)); }
testComparisonFailure
17,166
void () { final StringBuffer buf = new StringBuffer(); final IDEATestNGRemoteListener listener = createListener(buf); final String className = "a.ATest"; AssertionError throwable = new AssertionError("expected a new line expected [expected\nnewline] but found [actual\nnewline]"); MockTestNGResult foo = new MockTestNGResult(className, "testFoo", throwable, ArrayUtil.EMPTY_OBJECT_ARRAY); listener.onTestFailure(foo); String message = buf.toString(); String expectedFailureMessage = "##teamcity[testFailed name='ATest.testFoo' message='java.lang.AssertionError: expected a new line' expected='expected|nnewline' actual='actual|nnewline'"; Assert.assertTrue(message, message.contains(expectedFailureMessage)); }
testComparisonFailureWithMessage
17,167
void () { final StringBuffer buf = new StringBuffer(); final IDEATestNGRemoteListener listener = createListener(buf); final String className = "a.ATest"; AssertionError throwable = new ComparisonFailure("[there is an unexpected value]", "1", "0"); MockTestNGResult foo = new MockTestNGResult(className, "testFoo", throwable, ArrayUtil.EMPTY_OBJECT_ARRAY); listener.onTestFailure(foo); String message = buf.toString(); String expectedFailureMessage = "##teamcity[testFailed name='ATest.testFoo' message='org.junit.ComparisonFailure: |[there is an unexpected value|] ' expected='1' actual='0' "; Assert.assertTrue(message, message.contains(expectedFailureMessage)); }
testExplicitComparisonFailure
17,168
void () { final StringBuffer buf = new StringBuffer(); final IDEATestNGRemoteListener listener = createListener(buf); final String className = "a.ATest"; listener.onSuiteStart(className, true); final MockTestNGResult result = new MockTestNGResult("ATest", "testMe", null, new Object[]{null, null}); listener.onTestStart(result); listener.onTestFinished(result); final MockTestNGResult tearDown = new MockTestNGResult(className, "tearDown", null, new Object[] {new MyTestTestResult()}); listener.onConfigurationStart(tearDown); listener.onConfigurationSuccess(tearDown); listener.onSuiteFinish(className); Assert.assertEquals("output: " + buf, """ ##teamcity[enteredTheMatrix] ##teamcity[testSuiteStarted name ='ATest' locationHint = 'java:suite://a.ATest'] ##teamcity[testStarted name='ATest.testMe|[null, null|]' locationHint='java:test://ATest/testMe'] ##teamcity[testFinished name='ATest.testMe|[null, null|]'] ##teamcity[testStarted name='ATest.tearDown|[testName|]' locationHint='java:test://a.ATest/tearDown' config='true'] ##teamcity[testFinished name='ATest.tearDown|[testName|]'] ##teamcity[testSuiteFinished name='a.ATest'] """, StringUtil.convertLineSeparators(buf.toString())); }
testAfterMethodWithInjectedTestResult
17,169
void () { final StringBuffer buf = new StringBuffer(); final IDEATestNGRemoteListener listener = createListener(buf); final MockTestNGResult result = new MockTestNGResult("ATest", "testMe", null, new Object[]{null, null}); listener.onTestStart(result); listener.onTestFinished(result); Assert.assertEquals("output: " + buf, """ ##teamcity[enteredTheMatrix] ##teamcity[testSuiteStarted name ='ATest' locationHint = 'java:suite://ATest'] ##teamcity[testStarted name='ATest.testMe|[null, null|]' locationHint='java:test://ATest/testMe'] ##teamcity[testFinished name='ATest.testMe|[null, null|]'] """, StringUtil.convertLineSeparators(buf.toString())); }
testNullParameters
17,170
void () { final StringBuffer buf = new StringBuffer(); final IDEATestNGRemoteListener listener = createListener(buf); final MockTestNGResult result = new MockTestNGResult("ATest", "testMe", null, new Object[]{null, null}) { @Override public List<Integer> getIncludeMethods() { return Arrays.asList(1, 3, 5); } }; for (int i = 0; i < 3; i++) { listener.onTestStart(result); listener.onTestFinished(result); } Assert.assertEquals("output: " + buf, """ ##teamcity[enteredTheMatrix] ##teamcity[testSuiteStarted name ='ATest' locationHint = 'java:suite://ATest'] ##teamcity[testStarted name='ATest.testMe|[null, null|] (1)' locationHint='java:test://ATest/testMe|[1|]'] ##teamcity[testFinished name='ATest.testMe|[null, null|] (1)'] ##teamcity[testStarted name='ATest.testMe|[null, null|] (3)' locationHint='java:test://ATest/testMe|[3|]'] ##teamcity[testFinished name='ATest.testMe|[null, null|] (3)'] ##teamcity[testStarted name='ATest.testMe|[null, null|] (5)' locationHint='java:test://ATest/testMe|[5|]'] ##teamcity[testFinished name='ATest.testMe|[null, null|] (5)'] """, StringUtil.convertLineSeparators(buf.toString())); }
testIncludedMethods
17,171
List<Integer> () { return Arrays.asList(1, 3, 5); }
getIncludeMethods
17,172
void (XmlSuite suite, String expected) { final StringBuffer buf = new StringBuffer(); final IDEATestNGRemoteListener listener = createListener(buf); for (XmlTest test : suite.getTests()) { for (XmlClass aClass : test.getClasses()) { final String classFQName = aClass.getName(); for (XmlInclude include : aClass.getIncludedMethods()) { final String methodName = include.getName(); List<Integer> numbers = include.getInvocationNumbers(); if (numbers.isEmpty()) { numbers = Collections.singletonList(0); } for (Integer integer : numbers) { final MockTestNGResult result = new MockTestNGResult(classFQName, methodName, null, new Object[] {integer}); listener.onTestStart(result); listener.onTestFinished(result); } } } } Assert.assertEquals("output: " + buf, expected, StringUtil.convertLineSeparators(buf.toString())); }
doTest
17,173
IDEATestNGRemoteListener (final StringBuffer buf) { return new IDEATestNGRemoteListener(new PrintStream(new OutputStream() { @Override public void write(int b) { buf.append(new String(new byte[]{(byte)b}, StandardCharsets.UTF_8)); } })) { @Override protected String getTrace(Throwable tr) { return StringUtil.convertLineSeparators(super.getTrace(tr)); } }; }
createListener
17,174
void (int b) { buf.append(new String(new byte[]{(byte)b}, StandardCharsets.UTF_8)); }
write
17,175
String (Throwable tr) { return StringUtil.convertLineSeparators(super.getTrace(tr)); }
getTrace
17,176
Exception () { final Exception exception = new Exception(); exception.setStackTrace(new StackTraceElement[0]); return exception; }
createExceptionWithoutTrace
17,177
Object[] () { return myParams; }
getParameters
17,178
String () { return myMethodName; }
getMethodName
17,179
String () { return myMethodName; }
getDisplayMethodName
17,180
String () { return myClassName; }
getClassName
17,181
long () { return 0; }
getDuration
17,182
List<String> () { return Collections.singletonList(myClassName); }
getTestHierarchy
17,183
String () { return null; }
getFileName
17,184
String () { return null; }
getXmlTestName
17,185
Throwable () { return myThrowable; }
getThrowable
17,186
List<Integer> () { return null; }
getIncludeMethods
17,187
boolean (Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; MockTestNGResult result = (MockTestNGResult)o; if (!myClassName.equals(result.myClassName)) return false; if (!myMethodName.equals(result.myMethodName)) return false; if (!Objects.equals(myThrowable, result.myThrowable)) return false; // Probably incorrect - comparing Object[] arrays with Arrays.equals if (!Arrays.equals(myParams, result.myParams)) return false; return true; }
equals
17,188
int () { int result = myClassName.hashCode(); result = 31 * result + myMethodName.hashCode(); result = 31 * result + (myThrowable != null ? myThrowable.hashCode() : 0); result = 31 * result + (myParams != null ? Arrays.hashCode(myParams) : 0); return result; }
hashCode
17,189
String () { return empty.id(); }
id
17,190
void (long millis) { empty.setEndMillis(millis); }
setEndMillis
17,191
String () { return empty.getTestName(); }
getTestName
17,192
String () { return "testName"; }
getName
17,193
ITestNGMethod () { return empty.getMethod(); }
getMethod
17,194
void (ITestNGMethod method) { empty.setMethod(method); }
setMethod
17,195
int () { return empty.getStatus(); }
getStatus
17,196
void (int status) { empty.setStatus(status); }
setStatus
17,197
boolean () { return empty.isSuccess(); }
isSuccess
17,198
IClass () { return empty.getTestClass(); }
getTestClass
17,199
Throwable () { return empty.getThrowable(); }
getThrowable