diff --git a/src/test/java/org/elasticsearch/test/rest/ElasticsearchRestTests.java b/src/test/java/org/elasticsearch/test/rest/ElasticsearchRestTests.java index f864a89fefc..c5c64c65498 100644 --- a/src/test/java/org/elasticsearch/test/rest/ElasticsearchRestTests.java +++ b/src/test/java/org/elasticsearch/test/rest/ElasticsearchRestTests.java @@ -170,8 +170,10 @@ public class ElasticsearchRestTests extends ElasticsearchIntegrationTest { @AfterClass public static void close() { - restTestExecutionContext.close(); - restTestExecutionContext = null; + if (restTestExecutionContext != null) { + restTestExecutionContext.close(); + restTestExecutionContext = null; + } } /**