Package org.neo4j.cineasts.domain

Examples of org.neo4j.cineasts.domain.Movie


        assertEquals("movie found by id", movie, found);

    }
    @Test
    public void testGetMovieRecommendations() throws Exception {
        Movie movie = new Movie("1", "Test-Movie").persist();
        Movie movie2 = new Movie("2", "Test-Movie2").persist();
        User user=new User("me","me","me").persist();
        user.rate(movie,3,"me");
        User friend=new User("friend","friend","friend").persist();
        friend.rate(movie,5,"friend");
        friend.rate(movie2,3,"friend2");
View Full Code Here


        assertEquals("one recommendation", movie2, recommendations.get(0).getMovie());
        assertEquals("one recommendation", 3, recommendations.get(0).getRating());
    }
    @Test
    public void testRateMovie() throws Exception {
        Movie movie = new Movie("1", "Test-Movie").persist();
        User user=new User("me","me","me").persist();
        user.rate(movie, 5, "comment");
        final Rating rating = IteratorUtil.first(movie.getRatings());
        assertEquals("rating stars", 5, rating.getStars());
        assertEquals("rating comment", "comment", rating.getComment());
        assertEquals("rating user", user, rating.getUser());
        assertEquals("rating movie", movie, rating.getMovie());
    }
View Full Code Here

        assertEquals("rating movie", movie, rating.getMovie());
    }

    @Test
    public void testFindTwoMovies() throws Exception {
        Movie movie1 = new Movie("1", "Test-Movie1").persist();
        Movie movie2 = new Movie("2", "Test-Movie2").persist();
        Movie movie3 = new Movie("3", "Another-Movie3").persist();
        List<Movie> found = movieRepository.findByTitleLike("Test*", new PageRequest(0, 2)).getContent();
        assertEquals("2 movies found", 2, found.size());
        assertEquals("2 correct movies found by query", new HashSet<Movie>(asList(movie1, movie2)), new HashSet<Movie>(found));
    }
View Full Code Here

        assertEquals("2 correct movies found by query", new HashSet<Movie>(asList(movie1, movie2)), new HashSet<Movie>(found));
    }

    @Test
    public void testFindTwoMoviesButRestrictToOne() throws Exception {
        Movie movie1 = new Movie("1", "Test-Movie1").persist();
        Movie movie2 = new Movie("2", "Test-Movie2").persist();
        Movie movie3 = new Movie("3", "Another-Movie3").persist();
        List<Movie> found = movieRepository.findByTitleLike("Test*", new PageRequest(0, 1)).getContent();
        assertEquals("1 movie found",1,found.size());
        assertTrue("1 correct movie found by query", found.get(0).getTitle().startsWith("Test"));
    }
View Full Code Here

    @Autowired
    CineastsRepository cineastsRepository;

    @Test
    public void testImportMovie() throws Exception {
        Movie movie = importService.importMovie("2");
        assertEquals("movie-id","2", movie.getId());
        assertEquals("movie-title","Ariel", movie.getTitle());
    }
View Full Code Here

        assertEquals("movie-title","Ariel", movie.getTitle());
    }

    @Test
    public void testImportMovieTwice() throws Exception {
        Movie movie = importService.importMovie("2");
        Movie movie2 = importService.importMovie("2");
        final Movie foundMovie = cineastsRepository.getMovie("2");
        assertEquals("movie-id", movie, foundMovie);
    }
View Full Code Here

    @Autowired
    CineastsRepository repository;

    @Test
    public void testGetMovie() throws Exception {
        Movie movie = new Movie( "1", "Test-Movie" ).persist();
        Movie found = repository.getMovie( "1" );
        assertEquals( "movie found by id", movie, found );

    }
View Full Code Here

    }

    @Test
    public void testFindTwoMovies() throws Exception {
        Movie movie1 = new Movie( "1", "Test-Movie1" ).persist();
        Movie movie2 = new Movie( "2", "Test-Movie2" ).persist();
        Movie movie3 = new Movie( "3", "Another-Movie3" ).persist();
        Page<Movie> found = repository.findMovies( "Test*", 2 );

        Collection<Movie> movies = asCollection( found );

        assertEquals( "2 movies found", 2, movies.size() );
View Full Code Here

        assertThat( found, hasItem(movie2) );
    }

    @Test
    public void testFindTwoMoviesButRestrictToOne() throws Exception {
        Movie movie1 = new Movie( "1", "Test-Movie1" ).persist();
        Movie movie2 = new Movie( "2", "Test-Movie2" ).persist();
        Movie movie3 = new Movie( "3", "Another-Movie3" ).persist();
        Page<Movie> found = repository.findMovies( "Test*", 1 );

        Collection<Movie> movies = asCollection( found );

        assertEquals( "1 movie found", 1, movies.size() );
View Full Code Here

        assertEquals("movie-title","George M. Williamson", actor.getName());
    }

    @Test
    public void shouldImportMovieWithTwoDirectors() throws Exception {
        Movie movie = importService.importMovie("603");

        movie = movieRepository.findById(movie.getId());

        assertThat(movie.getDirectors().size(), is(2));
    }
View Full Code Here

TOP

Related Classes of org.neo4j.cineasts.domain.Movie

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.