@Test public void badLatLngThrowsGeoLocationException() { try { productService.getProductsByLocation("12345"); } catch (Exception ex) { Assert.assertTrue(ex instanceof GeoLocationException); } }
@Test public void highlightedResultsShouldContainTermsInBold() { List<Product> baseList = SolrTestUtils.createProductList(10); repo.save(baseList); HighlightPage<Product> highlightProductPage = productService.findByHighlightedName("product", new PageRequest(0, 20)); assertTrue(containsSnipplet(highlightProductPage, "<b>product</b>")); }
@Test public void badSimpleQueryThrowsUncategorizedSolrException() { int i = 0; try { productService.getProductsWithUserQuery("bad:field"); } catch (Exception ex) { i++; Assert.assertTrue(ex instanceof UncategorizedSolrException); } try { productService.getProductsWithUserQuery("bad::format"); } catch (UncategorizedSolrException ex) { i++; Assert.assertTrue(ex instanceof UncategorizedSolrException); } try { productService.getProductsWithUserQuery("name:goodQuery"); } catch (UncategorizedSolrException ex) { i++; } Assert.assertEquals(2, i); }