
package com.uwetrottmann.tmdb.services;

import com.uwetrottmann.tmdb.BaseTestCase;
import com.uwetrottmann.tmdb.entities.Movie;

import java.text.ParseException;
import java.text.SimpleDateFormat;

public class MoviesServiceTest extends BaseTestCase {

    private static final SimpleDateFormat JSON_STRING_DATE = new SimpleDateFormat("yyy-MM-dd");

    public void test_summary() throws ParseException {
        Movie movie = getManager().moviesService().summary(550);
        assertNotNull("Result was null.", movie);
        assertNotNull("Movie Adult was null.", movie.adult);
        assertEquals("Movie Adult does not match.", false, movie.adult.booleanValue());
        assertNotNull("Movie backdrop path was null.", movie.backdrop_path);
        assertNotNull("Movie budget was null.", movie.budget);
        assertEquals("Movie budget does not match.", 63000000, movie.budget.intValue());
        assertNotNull("Movie TMDB ID was null.", movie.id);
        assertEquals("Movie TMDB ID does not match.", 550, movie.id.intValue());
        assertEquals("Movie IMDB ID does not match.", "tt0137523", movie.imdb_id);
        assertEquals("Move orignal title does not match.", "Fight Club", movie.original_title);
        assertNotNull("Movie overview was null.", movie.overview);
        assertNotNull("Movie poster path was null.", movie.poster_path);
        assertNotNull("Movie release date was null.", movie.release_date);
        assertEquals("Movie release date does not match.", JSON_STRING_DATE.parse("1999-10-14"),
                movie.release_date);
        assertNotNull("Movie revenue was null.", movie.revenue);
        assertEquals("Movie revenue does not match.", 100853753, movie.revenue.intValue());
        assertNotNull("Movie runtime was null.", movie.runtime);
        assertEquals("Movie runtime does not match.", 139, movie.runtime.intValue());
        assertNotNull("Movie tagline was null.", movie.tagline);
        assertEquals("Move title does not match.", "Fight Club", movie.title);
        assertNotNull("Movie vote_average was null.", movie.vote_average);
        assertNotNull("Movie vote_count was null.", movie.vote_count);
    }
}

@@ -116,21 +116,167 @@
 ntities.
-Movie
+Credits;%0Aimport com.uwetrottmann.tmdb.entities.Movie;%0Aimport com.uwetrottmann.tmdb.entities.ResultsPage;%0Aimport com.uwetrottmann.tmdb.entities.Trailers
 ;%0A%0Aimpor
@@ -339,16 +339,78 @@
 ormat;%0A%0A
+import static org.fest.assertions.api.Assertions.assertThat;%0A%0A
 public c
@@ -670,16 +670,22 @@
 mary(550
+, null
 );%0A     
@@ -2299,24 +2299,24 @@
 e_average);%0A
-
         asse
@@ -2379,11 +2379,1764 @@
 );%0A    %7D
+%0A%0A    public void test_trailers() %7B%0A        Trailers trailers = getManager().moviesService().trailers(550);%0A        assertThat(trailers).isNotNull();%0A        assertThat(trailers.id).isEqualTo(550);%0A        assertThat(trailers.quicktime).isNotNull();%0A        assertThat(trailers.youtube).isNotNull();%0A    %7D%0A%0A    public void test_credits() %7B%0A        Credits credits = getManager().moviesService().credits(550);%0A        assertThat(credits).isNotNull();%0A        assertThat(credits.id).isEqualTo(550);%0A        assertThat(credits.cast).isNotEmpty();%0A        assertThat(credits.cast.get(0)).isNotNull();%0A        assertThat(credits.cast.get(0).name).isEqualTo(%22Edward Norton%22);%0A        assertThat(credits.crew).isNotEmpty();%0A    %7D%0A%0A    public void test_nowPlaying() %7B%0A        ResultsPage page = getManager().moviesService().nowPlaying(null, null);%0A        assertThat(page).isNotNull();%0A        assertThat(page.results).isNotEmpty();%0A    %7D%0A%0A    public void test_popular() %7B%0A        ResultsPage page = getManager().moviesService().popular(null, null);%0A        assertThat(page).isNotNull();%0A        assertThat(page.results).isNotEmpty();%0A    %7D%0A%0A    public void test_similar() %7B%0A        ResultsPage page = getManager().moviesService().similarMovies(550, null, null);%0A        assertThat(page).isNotNull();%0A        assertThat(page.results).isNotEmpty();%0A    %7D%0A%0A    public void test_topRated() %7B%0A        ResultsPage page = getManager().moviesService().topRated(null, null);%0A        assertThat(page).isNotNull();%0A        assertThat(page.results).isNotEmpty();%0A    %7D%0A%0A    public void test_upcoming() %7B%0A        ResultsPage page = getManager().moviesService().upcoming(null, null);%0A        assertThat(page).isNotNull();%0A        assertThat(page.results).isNotEmpty();%0A    %7D
 %0A%7D%0A

Create simple tests for all existing movies endpoints.