mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
junit: parameterized with dots
This commit is contained in:
+35
@@ -188,6 +188,41 @@ public class JUnitTreeByDescriptionHierarchyTest {
|
||||
"##teamcity[testSuiteFinished name='|[0|]']\n");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testParameterizedClassWithParamsWithDots() throws Exception {
|
||||
final String className = "a.TestA";
|
||||
final Description aTestClassDescription = Description.createSuiteDescription(className);
|
||||
final ArrayList<Description> tests = new ArrayList<Description>();
|
||||
for (String paramName : new String[]{"[0: with - 1.1]", "[1: with - 2.1]"}) {
|
||||
final Description param1 = Description.createSuiteDescription(paramName);
|
||||
aTestClassDescription.addChild(param1);
|
||||
final Description testDescription = Description.createTestDescription(className, "testName" + paramName);
|
||||
tests.add(testDescription);
|
||||
param1.addChild(testDescription);
|
||||
}
|
||||
doTest(aTestClassDescription, tests,
|
||||
//tree
|
||||
"##teamcity[suiteTreeStarted name='|[0: with - 1.1|]' locationHint='java:suite://a.TestA.|[0: with - 1.1|]']\n" +
|
||||
"##teamcity[suiteTreeNode name='testName|[0: with - 1.1|]' locationHint='java:test://a.TestA.testName|[0: with - 1.1|]']\n" +
|
||||
"##teamcity[suiteTreeEnded name='|[0: with - 1.1|]']\n" +
|
||||
"##teamcity[suiteTreeStarted name='|[1: with - 2.1|]' locationHint='java:suite://a.TestA.|[1: with - 2.1|]']\n" +
|
||||
"##teamcity[suiteTreeNode name='testName|[1: with - 2.1|]' locationHint='java:test://a.TestA.testName|[1: with - 2.1|]']\n" +
|
||||
"##teamcity[suiteTreeEnded name='|[1: with - 2.1|]']\n",
|
||||
//start
|
||||
"##teamcity[enteredTheMatrix]\n" +
|
||||
"##teamcity[rootName name = 'TestA' comment = 'a' location = 'java:suite://a.TestA']\n" +
|
||||
"##teamcity[testSuiteStarted name='|[0: with - 1.1|]']\n" +
|
||||
"##teamcity[testStarted name='testName|[0: with - 1.1|]' locationHint='java:test://a.TestA.testName|[0: with - 1.1|]']\n" +
|
||||
"\n" +
|
||||
"##teamcity[testFinished name='testName|[0: with - 1.1|]']\n" +
|
||||
"##teamcity[testSuiteFinished name='|[0: with - 1.1|]']\n" +
|
||||
"##teamcity[testSuiteStarted name='|[1: with - 2.1|]']\n" +
|
||||
"##teamcity[testStarted name='testName|[1: with - 2.1|]' locationHint='java:test://a.TestA.testName|[1: with - 2.1|]']\n" +
|
||||
"\n" +
|
||||
"##teamcity[testFinished name='testName|[1: with - 2.1|]']\n" +
|
||||
"##teamcity[testSuiteFinished name='|[1: with - 2.1|]']\n");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test2SuitesWithTheSameTest() throws Exception {
|
||||
final Description root = Description.createSuiteDescription("root");
|
||||
|
||||
@@ -382,11 +382,15 @@ public class JUnit4TestListener extends RunListener {
|
||||
|
||||
private static String getShortName(String fqName) {
|
||||
if (fqName == null) return null;
|
||||
if (fqName.startsWith("[")) {
|
||||
final int idx = fqName.indexOf("[");
|
||||
if (idx == 0) {
|
||||
//param name
|
||||
return fqName;
|
||||
}
|
||||
int lastPointIdx = fqName.lastIndexOf('.');
|
||||
if (idx > 0 && fqName.endsWith("]")) {
|
||||
lastPointIdx = fqName.substring(0, idx).lastIndexOf('.');
|
||||
}
|
||||
if (lastPointIdx >= 0) {
|
||||
return fqName.substring(lastPointIdx + 1);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user