Assert.assertEquals(toInsert.getPopularity(), recalled.getPopularity());
}
@Test
public void testPartialUpdateAddSingleValueToMultivalueField() {
ExampleSolrBean toInsert = createDefaultExampleBean();
toInsert.setPopularity(10);
toInsert.setCategory(Arrays.asList("nosql"));
solrTemplate.saveBean(toInsert);
solrTemplate.commit();
PartialUpdate update = new PartialUpdate("id", DEFAULT_BEAN_ID);
update.add(new SimpleUpdateField("cat", "spring-data-solr", UpdateAction.ADD));
solrTemplate.saveBean(update);
solrTemplate.commit();
Assert.assertEquals(1, solrTemplate.count(ALL_DOCUMENTS_QUERY));
ExampleSolrBean recalled = solrTemplate.queryForObject(DEFAULT_BEAN_OBJECT_QUERY, ExampleSolrBean.class);
Assert.assertEquals(toInsert.getId(), recalled.getId());
Assert.assertEquals(2, recalled.getCategory().size());
Assert.assertEquals(Arrays.asList("nosql", "spring-data-solr"), recalled.getCategory());
Assert.assertEquals(toInsert.getName(), recalled.getName());
Assert.assertEquals(toInsert.getPopularity(), recalled.getPopularity());
}