SettableFuture<QueryResult> result = SettableFuture.create();
ESCountTask.CountResponseListener listener = new ESCountTask.CountResponseListener(result);
ShardOperationFailedException[] shardFailures = new ShardOperationFailedException[] {
new DefaultShardOperationFailedException("dummy", 2,
new IndexShardException(new ShardId("dummy", 2), "dummy message"))
};
CountResponse countResponse = mock(CountResponse.class);
when(countResponse.getFailedShards()).thenReturn(1);
when(countResponse.getShardFailures()).thenReturn(shardFailures);