### Question:
SolrJavaIntegration { protected HttpSolrClient getSolrClient() { return solrClient; } SolrJavaIntegration(String clientUrl); void addProductBean(ProductBean pBean); void addSolrDocument(String documentId, String itemName, String itemPrice); void deleteSolrDocumentById(String documentId); void deleteSolrDocumentByQuery(String query);  }### Answer:
@Test public void whenAdd_thenVerifyAddedByQueryOnId() throws SolrServerException, IOException { SolrQuery query = new SolrQuery(); query.set("q", "id:123456"); QueryResponse response = null; response = solrJavaIntegration.getSolrClient().query(query); SolrDocumentList docList = response.getResults(); assertEquals(1, docList.getNumFound()); for (SolrDocument doc : docList) { assertEquals("Kenmore Dishwasher", (String) doc.getFieldValue("name")); assertEquals((Double) 599.99, (Double) doc.getFieldValue("price")); } }
@Test public void whenAdd_thenVerifyAddedByQueryOnPrice() throws SolrServerException, IOException { SolrQuery query = new SolrQuery(); query.set("q", "price:599.99"); QueryResponse response = null; response = solrJavaIntegration.getSolrClient().query(query); SolrDocumentList docList = response.getResults(); assertEquals(1, docList.getNumFound()); for (SolrDocument doc : docList) { assertEquals("123456", (String) doc.getFieldValue("id")); assertEquals((Double) 599.99, (Double) doc.getFieldValue("price")); } }
@Test public void whenAdd_thenVerifyAddedByQuery() throws SolrServerException, IOException { SolrDocument doc = solrJavaIntegration.getSolrClient().getById("123456"); assertEquals("Kenmore Dishwasher", (String) doc.getFieldValue("name")); assertEquals((Double) 599.99, (Double) doc.getFieldValue("price")); }