formatting format changes
This commit is contained in:
parent
d9eeb7c21a
commit
b3976c7fb5
@ -20,7 +20,6 @@ public class Product {
|
||||
@Field("description")
|
||||
private String description;
|
||||
|
||||
|
||||
public Product(String id, String name, String category) {
|
||||
this.id = id;
|
||||
this.name = name;
|
||||
|
@ -1,6 +1,5 @@
|
||||
package com.baeldung.spring.data.solr.repository;
|
||||
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.springframework.data.domain.Page;
|
||||
@ -17,8 +16,7 @@ public interface ProductRepository extends SolrCrudRepository<Product, String>{
|
||||
@Query("name:*?0* OR category:*?0* OR description:*?0*")
|
||||
public Page<Product> findByCustomQuery(String searchTerm, Pageable pageable);
|
||||
|
||||
|
||||
// @Query(name="Product.findByNamedQuery")
|
||||
@Query(name = "Product.findByNamedQuery")
|
||||
public Page<Product> findByNamedQuery(String searchTerm, Pageable pageable);
|
||||
|
||||
}
|
||||
|
@ -18,7 +18,6 @@ import com.baeldung.spring.data.solr.config.SolrConfig;
|
||||
import com.baeldung.spring.data.solr.model.Product;
|
||||
import com.baeldung.spring.data.solr.repository.ProductRepository;
|
||||
|
||||
|
||||
@RunWith(SpringJUnit4ClassRunner.class)
|
||||
@ContextConfiguration(classes = SolrConfig.class)
|
||||
public class ProductRepositoryIntegrationTest {
|
||||
@ -53,8 +52,6 @@ public class ProductRepositoryIntegrationTest {
|
||||
assertEquals(product.getCategory(), retrievedProduct.getCategory());
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Test
|
||||
public void whenDeletingProduct_thenNotAvailableOnRetrieval() throws Exception {
|
||||
final Product product = new Product("P0001", "Desk", "Furniture");
|
||||
@ -70,7 +67,7 @@ public class ProductRepositoryIntegrationTest {
|
||||
|
||||
@Test
|
||||
public void whenFindByName_thenAvailableOnRetrieval() throws Exception {
|
||||
final Product phone = new Product("P0001", "Phone", "Electronics");
|
||||
Product phone = new Product("P0001", "Phone", "Electronics");
|
||||
phone.setDescription("New Phone");
|
||||
productRepository.save(phone);
|
||||
|
||||
@ -92,7 +89,7 @@ public class ProductRepositoryIntegrationTest {
|
||||
wirelessCharger.setDescription("Wireless Charger for Phone");
|
||||
productRepository.save(wirelessCharger);
|
||||
|
||||
Page<Product> result = productRepository.findByCustomQuery("Pho", new PageRequest(0, 10));
|
||||
Page<Product> result = productRepository.findByCustomQuery("Phone", new PageRequest(0, 10));
|
||||
assertEquals(3, result.getNumberOfElements());
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user