### Question:
ElasticsearchStorageEngine extends CommonsStorageEngine<Client> { @Override @TimerJ protected void truncate(TableName tableName, Connection<Client> connection) throws UnsupportedException, ExecutionException { delete(tableName, Collections.EMPTY_LIST, connection); } ElasticsearchStorageEngine(ConnectionHandler connectionHandler);   }### Answer:
@Test public void testTruncate() throws Exception { Collection<Filter> whereFilter = Collections.EMPTY_LIST; QueryBuilderFactory queryBuilderFactory = mock(QueryBuilderFactory.class); QueryBuilder queryBuilder = mock(QueryBuilder.class); when(queryBuilderFactory.createBuilder(whereFilter)).thenReturn(queryBuilder); whenNew(QueryBuilderFactory.class).withNoArguments().thenReturn(queryBuilderFactory); ListenableActionFuture<DeleteByQueryResponse> listeneableActionFure = mock(ListenableActionFuture.class); DeleteByQueryRequestBuilder deleteByquery = mock(DeleteByQueryRequestBuilder.class); when(client.prepareDeleteByQuery(INDEX_NAME)).thenReturn(deleteByquery); when(deleteByquery.setQuery(queryBuilder)).thenReturn(deleteByquery); when(deleteByquery.execute()).thenReturn(listeneableActionFure); elasticsearchStorageEngine.delete(new TableName(INDEX_NAME, TYPE_NAME), whereFilter, connection); verify(listeneableActionFure).actionGet(); }