updating test cases
This commit is contained in:
-2
@@ -1,7 +1,6 @@
|
||||
package com.baeldung.spring.data.neo4j.config;
|
||||
|
||||
import org.neo4j.ogm.session.SessionFactory;
|
||||
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.ComponentScan;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
@@ -13,7 +12,6 @@ import org.springframework.transaction.annotation.EnableTransactionManagement;
|
||||
|
||||
@EnableTransactionManagement
|
||||
@EnableScheduling
|
||||
@EnableAutoConfiguration
|
||||
@ComponentScan(basePackages = {"com.baeldung.spring.data.neo4j.services"})
|
||||
@Configuration
|
||||
@EnableNeo4jRepositories(basePackages = "com.baeldung.spring.data.neo4j.repostory")
|
||||
|
||||
-2
@@ -4,14 +4,12 @@ import com.baeldung.spring.data.neo4j.domain.Movie;
|
||||
import org.springframework.data.neo4j.annotation.Query;
|
||||
import org.springframework.data.neo4j.repository.GraphRepository;
|
||||
import org.springframework.data.repository.query.Param;
|
||||
import org.springframework.data.rest.core.annotation.RepositoryRestResource;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
@RepositoryRestResource(collectionResourceRel = "movies", path = "movies")
|
||||
public interface MovieRepository extends GraphRepository<Movie> {
|
||||
Movie findByTitle(@Param("title") String title);
|
||||
|
||||
|
||||
+7
-5
@@ -82,7 +82,8 @@ public class MovieRepositoryTest {
|
||||
@DirtiesContext
|
||||
public void testFindAll() {
|
||||
System.out.println("findAll");
|
||||
Collection<Movie> result = (Collection<Movie>) instance.findAll();
|
||||
Collection<Movie> result =
|
||||
(Collection<Movie>) instance.findAll();
|
||||
assertNotNull(result);
|
||||
assertEquals(1, result.size());
|
||||
}
|
||||
@@ -92,7 +93,8 @@ public class MovieRepositoryTest {
|
||||
public void testFindByTitleContaining() {
|
||||
System.out.println("findByTitleContaining");
|
||||
String title = "Italian";
|
||||
Collection<Movie> result = instance.findByTitleContaining(title);
|
||||
Collection<Movie> result =
|
||||
instance.findByTitleContaining(title);
|
||||
assertNotNull(result);
|
||||
assertEquals(1,result.size());
|
||||
}
|
||||
@@ -115,8 +117,7 @@ public class MovieRepositoryTest {
|
||||
@DirtiesContext
|
||||
public void testDeleteMovie() {
|
||||
System.out.println("deleteMovie");
|
||||
instance.delete(
|
||||
instance.findByTitle("The Italian Job"));
|
||||
instance.delete(instance.findByTitle("The Italian Job"));
|
||||
assertNull(instance.findByTitle("The Italian Job"));
|
||||
}
|
||||
|
||||
@@ -125,7 +126,8 @@ public class MovieRepositoryTest {
|
||||
public void testDeleteAll() {
|
||||
System.out.println("deleteAll");
|
||||
instance.deleteAll();
|
||||
Collection<Movie> result = (Collection<Movie>) instance.findAll();
|
||||
Collection<Movie> result =
|
||||
(Collection<Movie>) instance.findAll();
|
||||
assertEquals(0,result.size());
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user