diff --git a/src/test/java/com/omertron/themoviedbapi/methods/TmdbMoviesTest.java b/src/test/java/com/omertron/themoviedbapi/methods/TmdbMoviesTest.java index 17902b2ea..eb558e776 100644 --- a/src/test/java/com/omertron/themoviedbapi/methods/TmdbMoviesTest.java +++ b/src/test/java/com/omertron/themoviedbapi/methods/TmdbMoviesTest.java @@ -21,23 +21,19 @@ package com.omertron.themoviedbapi.methods; import com.omertron.themoviedbapi.AbstractTests; import com.omertron.themoviedbapi.MovieDbException; +import com.omertron.themoviedbapi.TestID; import com.omertron.themoviedbapi.model.AlternativeTitle; import com.omertron.themoviedbapi.model.MovieDb; import com.omertron.themoviedbapi.model.MovieList; import com.omertron.themoviedbapi.model.ReleaseInfo; import com.omertron.themoviedbapi.model.Translation; import com.omertron.themoviedbapi.model.Video; +import com.omertron.themoviedbapi.model.person.Person; import com.omertron.themoviedbapi.model2.artwork.Artwork; import com.omertron.themoviedbapi.model2.keyword.Keyword; -import com.omertron.themoviedbapi.model2.movie.MovieBasic; import com.omertron.themoviedbapi.results.TmdbResultsList; +import java.util.ArrayList; import java.util.List; -import java.util.Random; -import org.junit.AfterClass; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertTrue; import static org.junit.Assert.fail; import org.junit.BeforeClass; import org.junit.Test; @@ -49,8 +45,7 @@ import org.junit.Test; public class TmdbMoviesTest extends AbstractTests { private static TmdbMovies instance; - private static final int ID_MOVIE_BLADE_RUNNER = 78; - private static final int ID_MOVIE_THE_AVENGERS = 24428; + private static final List FILM_IDS = new ArrayList(); public TmdbMoviesTest() { } @@ -60,297 +55,396 @@ public class TmdbMoviesTest extends AbstractTests { doConfiguration(); instance = new TmdbMovies(getApiKey(), getHttpTools()); - } + FILM_IDS.add(new TestID("Blade Runner", "", 78)); + FILM_IDS.add(new TestID("Jupiter Ascending", "tt1617661", 76757)); + FILM_IDS.add(new TestID("Lucy", "tt2872732", 240832)); - @AfterClass - public static void tearDownClass() { } /** - * Test of getMovieInfo method, of class TheMovieDbApi. + * Test of getMovieInfo method, of class TmdbMovies. * - * @throws MovieDbException + * @throws com.omertron.themoviedbapi.MovieDbException */ @Test public void testGetMovieInfo() throws MovieDbException { LOG.info("getMovieInfo"); - MovieDb result = instance.getMovieInfo(ID_MOVIE_BLADE_RUNNER, LANGUAGE_ENGLISH, "alternative_titles,casts,images,keywords,releases,trailers,translations,similar_movies,reviews,lists"); - assertEquals("Incorrect movie information", "Blade Runner", result.getOriginalTitle()); + + String language = ""; + String[] appendToResponse = null; + + for (TestID test : FILM_IDS) { + MovieDb result = instance.getMovieInfo(test.getTmdb(), language, appendToResponse); + } + // TODO review the generated test code and remove the default call to fail. + fail("The test case is a prototype."); } /** - * Test of getMovieInfoImdb method, of class TheMovieDbApi. + * Test of getMovieInfoImdb method, of class TmdbMovies. * - * @throws MovieDbException + * @throws com.omertron.themoviedbapi.MovieDbException */ @Test public void testGetMovieInfoImdb() throws MovieDbException { LOG.info("getMovieInfoImdb"); - MovieDb result = instance.getMovieInfoImdb("tt0076759", "en-US"); - assertTrue("Error getting the movie from IMDB ID", result.getId() == 11); + String language = ""; + String[] appendToResponse = null; + + for (TestID test : FILM_IDS) { + MovieDb result = instance.getMovieInfoImdb(test.getImdb(), language, appendToResponse); + } + // TODO review the generated test code and remove the default call to fail. + fail("The test case is a prototype."); } /** - * Test of getMovieAlternativeTitles method, of class TheMovieDbApi. + * Test of getMovieAccountState method, of class TmdbMovies. * - * @throws MovieDbException + * @throws com.omertron.themoviedbapi.MovieDbException + */ + @Test + public void testGetMovieAccountState() throws MovieDbException { + LOG.info("getMovieAccountState"); + + for (TestID test : FILM_IDS) { + String result = instance.getMovieAccountState(test.getTmdb(), getSessionId()); + } + // TODO review the generated test code and remove the default call to fail. + fail("The test case is a prototype."); + } + + /** + * Test of getMovieAlternativeTitles method, of class TmdbMovies. + * + * @throws com.omertron.themoviedbapi.MovieDbException */ @Test public void testGetMovieAlternativeTitles() throws MovieDbException { LOG.info("getMovieAlternativeTitles"); + String country = ""; - TmdbResultsList result = instance.getMovieAlternativeTitles(ID_MOVIE_BLADE_RUNNER, country, "casts,images,keywords,releases,trailers,translations,similar_movies,reviews,lists"); - assertTrue("No alternative titles found", result.getResults().size() > 0); + String[] appendToResponse = null; - country = "US"; - result = instance.getMovieAlternativeTitles(ID_MOVIE_BLADE_RUNNER, country); - assertTrue("No alternative titles found", result.getResults().size() > 0); + for (TestID test : FILM_IDS) { + TmdbResultsList result = instance.getMovieAlternativeTitles(test.getTmdb(), country, appendToResponse); + } + // TODO review the generated test code and remove the default call to fail. + fail("The test case is a prototype."); + } + /** + * Test of getMovieCredits method, of class TmdbMovies. + * + * @throws com.omertron.themoviedbapi.MovieDbException + */ + @Test + public void testGetMovieCredits() throws MovieDbException { + LOG.info("getMovieCredits"); + + String[] appendToResponse = null; + + for (TestID test : FILM_IDS) { + String result = instance.getMovieCredits(test.getTmdb(), appendToResponse); + } + // TODO review the generated test code and remove the default call to fail. + fail("The test case is a prototype."); } /** - * Test of getMovieCredits method, of class TheMovieDbApi. + * Test of getMovieCasts method, of class TmdbMovies. * - * @throws MovieDbException + * @throws com.omertron.themoviedbapi.MovieDbException */ @Test public void testGetMovieCasts() throws MovieDbException { LOG.info("getMovieCasts"); - /* - TmdbResultsList people = instance.getMovieCredits(ID_MOVIE_BLADE_RUNNER, "alternative_titles,casts,images,keywords,releases,trailers,translations,similar_movies,reviews,lists"); - assertTrue("No cast information", people.getResults().size() > 0); - - String name1 = "Harrison Ford"; - String name2 = "Charles Knode"; - boolean foundName1 = Boolean.FALSE; - boolean foundName2 = Boolean.FALSE; - - for (PersonMovieOld person : people.getResults()) { - if (!foundName1 && person.getName().equalsIgnoreCase(name1)) { - foundName1 = Boolean.TRUE; - } - - if (!foundName2 && person.getName().equalsIgnoreCase(name2)) { - foundName2 = Boolean.TRUE; - } - } - assertTrue("Couldn't find " + name1, foundName1); - assertTrue("Couldn't find " + name2, foundName2); - */ - fail("The test case is a prototype."); + String[] appendToResponse = null; + + for (TestID test : FILM_IDS) { + TmdbResultsList result = instance.getMovieCasts(test.getTmdb(), appendToResponse); + } + // TODO review the generated test code and remove the default call to fail. + fail("The test case is a prototype."); } /** - * Test of getMovieImages method, of class TheMovieDbApi. + * Test of getMovieImages method, of class TmdbMovies. * - * @throws MovieDbException + * @throws com.omertron.themoviedbapi.MovieDbException */ @Test public void testGetMovieImages() throws MovieDbException { LOG.info("getMovieImages"); + String language = ""; - TmdbResultsList result = instance.getMovieImages(ID_MOVIE_BLADE_RUNNER, language); - assertFalse("No artwork found", result.getResults().isEmpty()); + String[] appendToResponse = null; + + for (TestID test : FILM_IDS) { + TmdbResultsList result = instance.getMovieImages(test.getTmdb(), language, appendToResponse); + } + // TODO review the generated test code and remove the default call to fail. + fail("The test case is a prototype."); } /** - * Test of getMovieKeywords method, of class TheMovieDbApi. + * Test of getMovieKeywords method, of class TmdbMovies. * - * @throws MovieDbException + * @throws com.omertron.themoviedbapi.MovieDbException */ @Test public void testGetMovieKeywords() throws MovieDbException { LOG.info("getMovieKeywords"); - TmdbResultsList result = instance.getMovieKeywords(ID_MOVIE_BLADE_RUNNER); - assertFalse("No keywords found", result.getResults().isEmpty()); + + String[] appendToResponse = null; + + for (TestID test : FILM_IDS) { + TmdbResultsList result = instance.getMovieKeywords(test.getTmdb(), appendToResponse); + } + // TODO review the generated test code and remove the default call to fail. + fail("The test case is a prototype."); } /** - * Test of getMovieReleaseInfo method, of class TheMovieDbApi. + * Test of getMovieReleaseInfo method, of class TmdbMovies. * - * @throws MovieDbException + * @throws com.omertron.themoviedbapi.MovieDbException */ @Test public void testGetMovieReleaseInfo() throws MovieDbException { LOG.info("getMovieReleaseInfo"); - TmdbResultsList result = instance.getMovieReleaseInfo(ID_MOVIE_BLADE_RUNNER, ""); - assertFalse("Release information missing", result.getResults().isEmpty()); + + String language = ""; + String[] appendToResponse = null; + + for (TestID test : FILM_IDS) { + TmdbResultsList result = instance.getMovieReleaseInfo(test.getTmdb(), language, appendToResponse); + } + // TODO review the generated test code and remove the default call to fail. + fail("The test case is a prototype."); } /** - * Test of getMovieVideos method, of class TheMovieDbApi. + * Test of getMovieVideos method, of class TmdbMovies. * - * @throws MovieDbException + * @throws com.omertron.themoviedbapi.MovieDbException */ @Test - public void testGetMovieTrailers() throws MovieDbException { - LOG.info("getMovieTrailers"); - TmdbResultsList