@Test public void testWithSingleQueryFacet() throws Exception { SolrQueryMethod method = getQueryMethodByName("findByNameFacetOnPopularityQuery", String.class); Assert.assertFalse(method.hasAnnotatedQuery()); Assert.assertFalse(method.hasProjectionFields()); Assert.assertFalse(method.hasAnnotatedNamedQueryName()); Assert.assertFalse(method.hasFacetFields()); Assert.assertTrue(method.hasFacetQueries()); Assert.assertFalse(method.hasFilterQuery()); Assert.assertEquals(0, method.getFacetFields().size()); Assert.assertEquals(1, method.getFacetQueries().size()); Assert.assertEquals(Integer.valueOf(10), method.getFacetLimit()); Assert.assertEquals(Integer.valueOf(1), method.getFacetMinCount()); Assert.assertEquals("popularity:[* TO 5]", method.getFacetQueries().get(0)); }
@Test public void testWithMultipleQueryFacets() throws Exception { SolrQueryMethod method = getQueryMethodByName("findByNameFacetOnAvailableQuery", String.class); Assert.assertFalse(method.hasAnnotatedQuery()); Assert.assertFalse(method.hasProjectionFields()); Assert.assertFalse(method.hasAnnotatedNamedQueryName()); Assert.assertFalse(method.hasFacetFields()); Assert.assertTrue(method.hasFacetQueries()); Assert.assertFalse(method.hasFilterQuery()); Assert.assertEquals(0, method.getFacetFields().size()); Assert.assertEquals(2, method.getFacetQueries().size()); Assert.assertEquals(Integer.valueOf(10), method.getFacetLimit()); Assert.assertEquals(Integer.valueOf(1), method.getFacetMinCount()); Assert.assertEquals("inStock:true", method.getFacetQueries().get(0)); Assert.assertEquals("inStock:false", method.getFacetQueries().get(1)); }