Do not print null method name in reproduce line (#41691)

This commit updates the reproduce line that is printed out when a test
fails so that it does not output `.null` as the method name when the
failure is not a specific method but a class level issue such as
threads being leaked from the SUITE. Previously, when this occurred the
reproduce line would look like:

`./gradlew :server:integTest --tests "org.elasticsearch.indices.memory.breaker.CircuitBreakerServiceIT.null"`

and after this change, the line no longer contains the `.null` after
the class name.
This commit is contained in:
Jay Modi 2019-05-02 12:19:39 -06:00 committed by jaymode
parent 0d9797847a
commit 8421e38887
No known key found for this signature in database
GPG Key ID: D859847567B3493D
1 changed files with 5 additions and 2 deletions

View File

@ -82,8 +82,11 @@ public class ReproduceInfoPrinter extends RunListener {
b.append(task);
b.append(" --tests \"");
b.append(failure.getDescription().getClassName());
b.append(".");
b.append(failure.getDescription().getMethodName());
final String methodName = failure.getDescription().getMethodName();
if (methodName != null) {
b.append(".");
b.append(failure.getDescription().getMethodName());
}
b.append("\"");
GradleMessageBuilder gradleMessageBuilder = new GradleMessageBuilder(b);