SolrQueryExecutor implements QueryExecutor { public <T> T save(T entity) { try { solrServer.addBean(entity); } catch (Exception e) { throw new RuntimeException(e); } return entity; } SolrQueryExecutor(SolrServer solrServer,
            SolrQueryTranslator queryTranslator); @Override Iterable<R> find(Query<T, R> query); @Override R findOne(Query<T, R> query); T save(T entity); Iterable<T> save(Iterable<T> entities);  }
@Test public void save() { TestClass saved = executor.save(t1); assertEquals(t1, saved); }
@Test public void save_many() { Iterable<TestClass> saved = executor.save(Arrays.asList(tests)); Iterator<TestClass> iterator = saved.iterator(); for (int i = 0; i < tests.length; i++) { assertEquals(tests[i], iterator.next()); } }
@Test(expected = RuntimeException.class) public void save_fail() throws IOException, SolrServerException { when(solrServer.addBean(t1)).thenThrow(new SolrException(null, queryString)); executor.save(t1); }