junit sm: accept null method names in list nodes

This commit is contained in:
Anna Kozlova
2015-10-06 17:36:55 +02:00
parent 488d53a015
commit 2b1d69daf1
2 changed files with 6 additions and 0 deletions
@@ -34,6 +34,7 @@ public class JUnitTreeByDescriptionHierarchyTest {
@Test
public void testEmptySuite() throws Exception {
doTest(Description.createSuiteDescription("empty suite"), "##teamcity[enteredTheMatrix]\n" +
"##teamcity[suiteTreeNode name='empty suite' locationHint='java:test://empty suite.empty suite']\n" +
"##teamcity[treeEnded]\n");
}
@@ -220,6 +220,11 @@ public class JUnit4TestListener extends RunListener {
if (methodName != null && (parent == null || !isParameter(parent))) {
methodName = getShortName(JUnit4ReflectionUtil.getClassName(description)) + "." + methodName;
}
if (methodName == null && description.getChildren().isEmpty()) {
methodName = description.getDisplayName();
}
myMethodNames.put(description, methodName);
}
return methodName;