SimpleQuery statsQuery = new SimpleQuery(new SimpleStringCriteria("*:*"));
statsQuery.setStatsOptions(statsOptions);
StatsPage<ExampleSolrBean> statResultPage = solrTemplate.queryForStatsPage(statsQuery, ExampleSolrBean.class);
FieldStatsResult priceStats = statResultPage.getFieldStatsResult("price");
Assert.assertEquals(Long.valueOf(2), priceStats.getCount());
Assert.assertEquals(10D, priceStats.getMin());
Assert.assertEquals(20.50, priceStats.getMax());
Assert.assertEquals(Double.valueOf(10), priceStats.getMinAsDouble());
Assert.assertEquals(Double.valueOf(20.50), priceStats.getMaxAsDouble());
Assert.assertEquals("10.0", priceStats.getMinAsString());
Assert.assertEquals("20.5", priceStats.getMaxAsString());
Assert.assertNull(priceStats.getMinAsDate());
Assert.assertNull(priceStats.getMaxAsDate());
Assert.assertEquals(Double.valueOf(15.25), priceStats.getMean());
Assert.assertEquals(Double.valueOf(30.50), priceStats.getSum());
Assert.assertEquals(Long.valueOf(0), priceStats.getMissing());
Assert.assertEquals(Double.valueOf(7.424621202458749), priceStats.getStddev());
Assert.assertEquals(Double.valueOf(520.25), priceStats.getSumOfSquares());
Map<String, StatsResult> facetStatsResult = priceStats.getFacetStatsResult(new SimpleField("name"));
Assert.assertEquals(2, facetStatsResult.size());
{
StatsResult nameFacetStatsResult = facetStatsResult.get("one");
Assert.assertEquals(Long.valueOf(1), nameFacetStatsResult.getCount());
Assert.assertEquals(10D, nameFacetStatsResult.getMin());