### Question:
SolrQueryExecutor { public QueryResponse executeQuery(SolrQuery query) { Preconditions.checkNotNull(query); QueryResponse response = null; try { response = solrServer.query(query); } catch (SolrServerException e) { throw new SolrSearchExecutionException("Couldn't execute query", e); } return response; }  QueryResponse executeQuery(SolrQuery query); @Autowired @Qualifier("solrJudgmentsServer") void setSolrServer(SolrServer solrServer);  }### Answer:
@Test public void executeQuery() throws SolrServerException { QueryResponse response = new QueryResponse(); when(solrServer.query(any())).thenReturn(response); QueryResponse retResponse = solrQueryExecutor.executeQuery(new SolrQuery()); assertTrue(retResponse == response); }
@Test(expected = SolrSearchExecutionException.class) public void executeQuery_SOLR_EXCEPTION() throws SolrServerException { when(solrServer.query(any())).thenThrow(new SolrServerException("")); solrQueryExecutor.executeQuery(new SolrQuery()); }
@Test(expected = NullPointerException.class) public void executeQuery_NULL_QUERY() { solrQueryExecutor.executeQuery(null); }