From b9061c1cc9b2ea74cc417b8749b47045e1b498ad Mon Sep 17 00:00:00 2001 From: Tanguy Leroux Date: Tue, 10 Jan 2017 13:12:00 +0100 Subject: [PATCH] [TESTS] Fix GetResultTests.testGetSourceAsBytes() (#22524) The document in the randomized GetResult can exist with no source (like if the _source was disabled in mappings), that's why the test should not always expect a non null source when the doc exists. --- .../test/java/org/elasticsearch/index/get/GetResultTests.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/src/test/java/org/elasticsearch/index/get/GetResultTests.java b/core/src/test/java/org/elasticsearch/index/get/GetResultTests.java index 0d0008cd1ce..b0e3b87d37d 100644 --- a/core/src/test/java/org/elasticsearch/index/get/GetResultTests.java +++ b/core/src/test/java/org/elasticsearch/index/get/GetResultTests.java @@ -83,7 +83,7 @@ public class GetResultTests extends ESTestCase { XContentType xContentType = randomFrom(XContentType.values()); Tuple tuple = randomGetResult(xContentType); GetResult getResult = tuple.v1(); - if (getResult.isExists()) { + if (getResult.isExists() && getResult.isSourceEmpty() == false) { assertNotNull(getResult.sourceRef()); } else { assertNull(getResult.sourceRef());