From b97610f245de7deace461cef2d9430bdb6b1b185 Mon Sep 17 00:00:00 2001 From: David Kyle Date: Thu, 15 Dec 2016 12:01:09 +0000 Subject: [PATCH] Streamed boolean values can on be 0 or 1 Original commit: elastic/x-pack-elasticsearch@16ffa0727b210e599f65ed736fe743cd8e05a46e --- .../xpack/prelert/job/persistence/MockClientBuilder.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/elasticsearch/src/test/java/org/elasticsearch/xpack/prelert/job/persistence/MockClientBuilder.java b/elasticsearch/src/test/java/org/elasticsearch/xpack/prelert/job/persistence/MockClientBuilder.java index 6cd46ea6c5e..3002c466b31 100644 --- a/elasticsearch/src/test/java/org/elasticsearch/xpack/prelert/job/persistence/MockClientBuilder.java +++ b/elasticsearch/src/test/java/org/elasticsearch/xpack/prelert/job/persistence/MockClientBuilder.java @@ -171,8 +171,10 @@ public class MockClientBuilder { ActionListener actionListener) throws InterruptedException, ExecutionException, IOException { DeleteIndexResponse response = DeleteIndexAction.INSTANCE.newResponse(); StreamInput si = mock(StreamInput.class); - when(si.readByte()).thenReturn((byte) 0x41); - when(si.readMap()).thenReturn(mock(Map.class)); + // this looks complicated but Mockito can't mock the final method + // DeleteIndexResponse.isAcknowledged() and the only way to create + // one with a true response is reading from a stream. + when(si.readByte()).thenReturn((byte) 0x01); response.readFrom(si); doAnswer(invocation -> {