Switch branches/tags
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
52 lines (42 sloc) 1.43 KB
import com.ignaciosuay.SpringNeo4JApp
import com.ignaciosuay.domain.Movie
import com.ignaciosuay.domain.Person
import com.ignaciosuay.repository.MovieRepository
import com.ignaciosuay.service.MovieService
import org.springframework.beans.factory.annotation.Autowired
import org.springframework.boot.test.context.SpringBootTest
import spock.genesis.Gen
import spock.genesis.generators.Generator
import spock.lang.Specification
import spock.lang.Unroll
@SpringBootTest(classes = SpringNeo4JApp.class)
class MovieServiceSpockIT extends Specification {
MovieRepository movieRepository;
MovieService movieService;
def "given a movie #movie.title save it into the database"() {
when: "A movie is created"
def movieSaved = movieService.createMovie(movie)
then: "Check the movie is in the database with the correct values"
def foundMovie = movieRepository.findOne(movieSaved.getId())
foundMovie.title == movie.title
foundMovie.director == movie.director
movie << getMovie().take(10)
Generator getMovie() {
return Gen.type(Movie,
title: Gen.string(20),
director: getPerson()
Generator getPerson() {
return Gen.type(Person,
name: Gen.string(10),
birthday: Gen.string(10))