Streamed boolean values can on be 0 or 1

Original commit: elastic/x-pack-elasticsearch@16ffa0727b
This commit is contained in:
David Kyle 2016-12-15 12:01:09 +00:00
parent faf54d4952
commit b97610f245
1 changed files with 4 additions and 2 deletions

View File

@ -171,8 +171,10 @@ public class MockClientBuilder {
ActionListener<DeleteJobAction.Response> 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 -> {