### Question:
ElasticsearchQueryEngine extends SingleProjectQueryEngine<Client> { @Override @TimerJ protected QueryResult execute(Project project, Connection<Client> connection) throws ConnectorException { Client elasticClient = connection.getNativeConnection(); ProjectParsed projectParsed = new ProjectParsed(project, new ESProjectParsedValidator()); SearchRequestBuilder requestBuilder = (SearchRequestBuilder) queryBuilder.buildQuery(elasticClient, projectParsed); return queryExecutor.executeQuery(elasticClient, requestBuilder, projectParsed); } ElasticsearchQueryEngine(ConnectionHandler connectionHandler); @Override @TimerJ void stop(String queryId);  }### Answer:
@Test public void testExecute() throws Exception { Project project = mock(Project.class); Connection<Client> connection = mock(Connection.class); Client eSConnection = mock(Client.class); when(connection.getNativeConnection()).thenReturn(eSConnection); ProjectParsed projectParsed = mock(ProjectParsed.class); ESProjectParsedValidator projectValidator = mock(ESProjectParsedValidator.class); whenNew(ESProjectParsedValidator.class).withNoArguments().thenReturn(projectValidator); whenNew(ProjectParsed.class).withArguments(project, projectValidator).thenReturn(projectParsed); SearchRequestBuilder searchRequestBuilder = mock(SearchRequestBuilder.class); when(queryBuilder.buildQuery(eSConnection, projectParsed)).thenReturn(searchRequestBuilder); ResultSet resultSet = mock(ResultSet.class); QueryResult queryResult = QueryResult.createQueryResult(resultSet, 0, true); when(queryExecutor.executeQuery(eSConnection, searchRequestBuilder, projectParsed)).thenReturn(queryResult); QueryResult returnQueryResult = elasticsearchQueryEngine.execute(project, connection); assertEquals("The query result is correct", queryResult, returnQueryResult); }