mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
junit: reject tests without method name during building of a tree (IDEA-158727)
This commit is contained in:
-1
@@ -34,7 +34,6 @@ 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");
|
||||
}
|
||||
|
||||
|
||||
@@ -306,6 +306,12 @@ public class JUnit4TestListener extends RunListener {
|
||||
}
|
||||
|
||||
private String getFullMethodName(Description description, Description parent) {
|
||||
return getFullMethodName(description, parent, false);
|
||||
}
|
||||
|
||||
private String getFullMethodName(Description description,
|
||||
Description parent,
|
||||
boolean acceptNull) {
|
||||
String methodName = (String)myMethodNames.get(description);
|
||||
if (methodName == null) {
|
||||
methodName = JUnit4ReflectionUtil.getMethodName(description);
|
||||
@@ -313,7 +319,7 @@ public class JUnit4TestListener extends RunListener {
|
||||
methodName = getShortName(JUnit4ReflectionUtil.getClassName(description)) + "." + methodName;
|
||||
}
|
||||
|
||||
if (methodName == null && description.getChildren().isEmpty()) {
|
||||
if (!acceptNull && methodName == null && description.getChildren().isEmpty()) {
|
||||
methodName = getShortName(description.getDisplayName());
|
||||
}
|
||||
|
||||
@@ -463,7 +469,7 @@ public class JUnit4TestListener extends RunListener {
|
||||
|
||||
String className = JUnit4ReflectionUtil.getClassName(description);
|
||||
if (description.isTest()) {
|
||||
final String methodName = getFullMethodName((Description)description, parent);
|
||||
final String methodName = getFullMethodName((Description)description, parent, true);
|
||||
if (methodName != null ) {
|
||||
if (isWarning(methodName, className) && parent != null) {
|
||||
className = JUnit4ReflectionUtil.getClassName(parent);
|
||||
|
||||
Reference in New Issue
Block a user