updating test cases

This commit is contained in:
Sameera 2016-06-28 23:17:24 +05:30
parent 718c04ceeb
commit 1a3e005442
4 changed files with 7 additions and 51 deletions

View File

@ -13,15 +13,8 @@
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<neo4j.version>3.0.1</neo4j.version>
<spring-data-neo4j.version>4.1.1.RELEASE</spring-data-neo4j.version>
<spring-data-releasetrain.version>Hopper-SR1</spring-data-releasetrain.version>
</properties>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.3.0.RELEASE</version>
</parent>
<dependencies>
<dependency>
<groupId>org.springframework.data</groupId>
@ -29,11 +22,6 @@
<version>${spring-data-neo4j.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-rest</artifactId>
</dependency>
<dependency>
<groupId>com.voodoodyne.jackson.jsog</groupId>
<artifactId>jackson-jsog</artifactId>
@ -41,9 +29,6 @@
<scope>compile</scope>
</dependency>
<!-- end::dependencies[] -->
<!-- Test Dependencies -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
@ -89,11 +74,6 @@
<artifactId>junit</artifactId>
<version>4.12</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-test</artifactId>
@ -107,29 +87,7 @@
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
<repositories>
<repository>
<id>spring-milestones</id>
<url>http://repo.spring.io/libs-snapshot</url>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>spring-milestones</id>
<url>http://repo.spring.io/libs-snapshot</url>
<snapshots>
<enabled>true</enabled>
</snapshots>
</pluginRepository>
</pluginRepositories>
</project>

View File

@ -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")

View File

@ -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);

View File

@ -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());
}
}