From ebbad60d747114bf8927c0c74b3b38cc42ccdae2 Mon Sep 17 00:00:00 2001 From: Jay Modi Date: Thu, 2 May 2019 12:19:39 -0600 Subject: [PATCH] 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. --- .../test/junit/listeners/ReproduceInfoPrinter.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/test/framework/src/main/java/org/elasticsearch/test/junit/listeners/ReproduceInfoPrinter.java b/test/framework/src/main/java/org/elasticsearch/test/junit/listeners/ReproduceInfoPrinter.java index b1a4c42cbfd8e..054b126b4ef4f 100644 --- a/test/framework/src/main/java/org/elasticsearch/test/junit/listeners/ReproduceInfoPrinter.java +++ b/test/framework/src/main/java/org/elasticsearch/test/junit/listeners/ReproduceInfoPrinter.java @@ -82,8 +82,11 @@ public void testFailure(Failure failure) throws Exception { 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);