Updated test names and moved document add code to @Before method. (#1187)
* Solr w Apache SolrJ * Solr w Apache SolrJ * updated test names and moved add to @before method
This commit is contained in:
parent
6b0e59afac
commit
935b815ad4
|
@ -18,24 +18,24 @@ import org.junit.Test;
|
|||
public class SolrJavaIntegrationTest {
|
||||
|
||||
private HttpSolrClient solr;
|
||||
private SolrInputDocument document;
|
||||
|
||||
@Before
|
||||
public void setUp() throws Exception {
|
||||
|
||||
solr = new HttpSolrClient("http://localhost:8983/solr/bigboxstore");
|
||||
solr.setParser(new XMLResponseParser());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void givenAdd_thenVerifyAdded() throws SolrServerException, IOException {
|
||||
|
||||
SolrInputDocument document = new SolrInputDocument();
|
||||
document = new SolrInputDocument();
|
||||
document.addField("id", "123456");
|
||||
document.addField("name", "Kenmore Dishwasher");
|
||||
document.addField("price", "599.99");
|
||||
|
||||
solr.add(document);
|
||||
solr.commit();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void whenAdd_thenVerifyAdded() throws SolrServerException, IOException {
|
||||
|
||||
SolrQuery query = new SolrQuery();
|
||||
query.set("q", "id:123456");
|
||||
|
@ -53,7 +53,7 @@ public class SolrJavaIntegrationTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void givenDelete_thenVerifyDeleted() throws SolrServerException, IOException {
|
||||
public void whenDelete_thenVerifyDeleted() throws SolrServerException, IOException {
|
||||
|
||||
solr.deleteById("123456");
|
||||
solr.commit();
|
||||
|
|
Loading…
Reference in New Issue