@Test(dependsOnMethods = "testAddDocument")
 public void testBasicQuery() throws SolrServerException {
   SolrServer server = solrServerFactory.getServer();
   SolrParams params = new SolrQuery("*:*");
   SolrDocumentList results = server.query(params).getResults();
   assertTrue(results.getNumFound() > 0, "didn't return any results");
 }
 @Test(dependsOnMethods = {"testGetServer"})
 public void testBadQuery() throws SolrServerException {
   SolrServer server = solrServerFactory.getServer();
   SolrParams params = new SolrQuery("text that is not found");
   QueryResponse response = server.query(params);
   assertEquals(0L, response.getResults().getNumFound());
 }
 @Test(dependsOnMethods = "testBasicQuery", dataProvider = "documentMap")
 public void testIdQuery(Map<String, String[]> document) throws SolrServerException {
   String id = document.get("id")[0];
   SolrServer server = solrServerFactory.getServer();
   SolrParams params = new SolrQuery("id:" + id);
   SolrDocumentList results = server.query(params).getResults();
   assertEquals(results.getNumFound(), 1, "didn't find article by id");
 }
  @Test(dependsOnMethods = "testAddDocument", dataProvider = "documentMap")
  public void testMultiValuedField(Map<String, String[]> document) throws Exception {
    String value1 = document.get("alternate_title")[0];
    String value2 = document.get("alternate_title")[1];

    Long numFound =
        solrServerFactory
            .getServer()
            .query(new SolrQuery("alternate_title:" + value1))
            .getResults()
            .getNumFound();
    assertTrue(numFound > 0l, "query didn't work on multivalued field");

    numFound =
        solrServerFactory
            .getServer()
            .query(new SolrQuery("alternate_title:" + value2))
            .getResults()
            .getNumFound();
    assertTrue(numFound > 0l, "query didn't work on multivalued field");
  }
 @Test(
     dataProvider = "documentMap",
     dependsOnMethods = {"testGetServer"})
 public void testAddDocument(Map<String, String[]> document) throws Exception {
   solrServerFactory.addDocument(document);
 }
 @Test
 public void testGetServer() throws SolrServerException {
   SolrServer server = solrServerFactory.getServer();
   assertNotNull(server, "created null server");
 }
 @AfterClass
 public void tearDown() throws Exception {
   solrServerFactory.tearDown();
 }