diff --git a/src/main/java/com/omertron/themoviedbapi/model/ChangeItem.java b/src/main/java/com/omertron/themoviedbapi/model/ChangeItem.java
deleted file mode 100644
index a064a7712..000000000
--- a/src/main/java/com/omertron/themoviedbapi/model/ChangeItem.java
+++ /dev/null
@@ -1,122 +0,0 @@
-/*
- * Copyright (c) 2004-2013 Stuart Boston
- *
- * This file is part of TheMovieDB API.
- *
- * TheMovieDB API is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * any later version.
- *
- * TheMovieDB API is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with TheMovieDB API. If not, see .
- *
- */
-package com.omertron.themoviedbapi.model;
-
-import com.fasterxml.jackson.annotation.JsonAnySetter;
-import com.fasterxml.jackson.annotation.JsonProperty;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class ChangeItem {
-
- private static final long serialVersionUID = 1L;
-
- /*
- * Logger
- */
- private static final Logger LOG = LoggerFactory.getLogger(MovieChanges.class);
- /*
- * Properties
- */
- @JsonProperty("id")
- private String id;
- @JsonProperty("action")
- private String action;
- @JsonProperty("time")
- private String time;
- @JsonProperty("value")
- private ChangeValue value;
- @JsonProperty("original_value")
- private ChangeValue originalValue;
- @JsonProperty("iso_639_1")
- private String language;
-
- //
- public String getId() {
- return id;
- }
-
- public String getAction() {
- return action;
- }
-
- public String getTime() {
- return time;
- }
-
- public ChangeValue getValue() {
- return value;
- }
-
- public ChangeValue getOriginalValue() {
- return originalValue;
- }
-
- public String getLanguage() {
- return language;
- }
- //
-
- //
- public void setId(String id) {
- this.id = id;
- }
-
- public void setAction(String action) {
- this.action = action;
- }
-
- public void setTime(String time) {
- this.time = time;
- }
-
- public void setValue(ChangeValue value) {
- this.value = value;
- }
-
- public void setOriginalValue(ChangeValue originalValue) {
- this.originalValue = originalValue;
- }
-
- public void setLanguage(String language) {
- this.language = language;
- }
-
- //
-
- @Override
- public String toString() {
- return "ChangeItem{" + "id=" + id + ", action=" + action + ", time=" + time + ", value=" + value + '}';
- }
-
- /**
- * Handle unknown properties and print a message
- *
- * @param key
- * @param value
- */
- @JsonAnySetter
- public void handleUnknown(String key, Object value) {
- StringBuilder sb = new StringBuilder();
- sb.append("Unknown property: '").append(key);
- sb.append("' value: '").append(value).append("'");
- LOG.trace(sb.toString());
- }
-}
diff --git a/src/main/java/com/omertron/themoviedbapi/model/ChangeValue.java b/src/main/java/com/omertron/themoviedbapi/model/ChangeValue.java
deleted file mode 100644
index b3cd2ff90..000000000
--- a/src/main/java/com/omertron/themoviedbapi/model/ChangeValue.java
+++ /dev/null
@@ -1,128 +0,0 @@
-/*
- * Copyright (c) 2004-2013 Stuart Boston
- *
- * This file is part of TheMovieDB API.
- *
- * TheMovieDB API is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * any later version.
- *
- * TheMovieDB API is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with TheMovieDB API. If not, see .
- *
- */
-package com.omertron.themoviedbapi.model;
-
-import com.fasterxml.jackson.annotation.JsonAnySetter;
-import com.fasterxml.jackson.annotation.JsonProperty;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class ChangeValue {
-
- private static final long serialVersionUID = 1L;
-
- /*
- * Logger
- */
- private static final Logger LOG = LoggerFactory.getLogger(MovieChanges.class);
- /*
- * Properties
- */
- @JsonProperty("poster")
- private Artwork poster;
- @JsonProperty("backdrop")
- private Artwork backdrop;
- @JsonProperty("title")
- private String title;
- @JsonProperty("iso_3166_1")
- private String language;
- @JsonProperty("site")
- private String site;
- @JsonProperty("name")
- private String name;
- @JsonProperty("id")
- private int id;
-
- //
- public Artwork getPoster() {
- return poster;
- }
-
- public Artwork getBackdrop() {
- return backdrop;
- }
-
- public String getTitle() {
- return title;
- }
-
- public String getLanguage() {
- return language;
- }
-
- public String getSite() {
- return site;
- }
-
- public String getName() {
- return name;
- }
-
- public int getId() {
- return id;
- }
- //
-
- //
- public void setPoster(Artwork poster) {
- this.poster = poster;
- }
-
- public void setBackdrop(Artwork backdrop) {
- this.backdrop = backdrop;
- backdrop.setArtworkType(ArtworkType.BACKDROP);
- }
-
- public void setTitle(String title) {
- this.title = title;
- }
-
- public void setLanguage(String language) {
- this.language = language;
- }
-
- public void setSite(String site) {
- this.site = site;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
- public void setId(int id) {
- this.id = id;
- }
-
- //
-
- /**
- * Handle unknown properties and print a message
- *
- * @param key
- * @param value
- */
- @JsonAnySetter
- public void handleUnknown(String key, Object value) {
- StringBuilder sb = new StringBuilder();
- sb.append("Unknown property: '").append(key);
- sb.append("' value: '").append(value).append("'");
- LOG.trace(sb.toString());
- }
-}
diff --git a/src/main/java/com/omertron/themoviedbapi/model/JobDepartment.java b/src/main/java/com/omertron/themoviedbapi/model/JobDepartment.java
index 94f6d52c0..03986e728 100644
--- a/src/main/java/com/omertron/themoviedbapi/model/JobDepartment.java
+++ b/src/main/java/com/omertron/themoviedbapi/model/JobDepartment.java
@@ -29,7 +29,7 @@ public class JobDepartment {
private static final long serialVersionUID = 1L;
// Logger
- private static final Logger LOG = LoggerFactory.getLogger(MovieChanges.class);
+ private static final Logger LOG = LoggerFactory.getLogger(JobDepartment.class);
// Properties
@JsonProperty("department")
private String department;
diff --git a/src/main/java/com/omertron/themoviedbapi/model/MovieChanges.java b/src/main/java/com/omertron/themoviedbapi/model/MovieChanges.java
deleted file mode 100644
index b6e13f14b..000000000
--- a/src/main/java/com/omertron/themoviedbapi/model/MovieChanges.java
+++ /dev/null
@@ -1,82 +0,0 @@
-/*
- * Copyright (c) 2004-2013 Stuart Boston
- *
- * This file is part of TheMovieDB API.
- *
- * TheMovieDB API is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * any later version.
- *
- * TheMovieDB API is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with TheMovieDB API. If not, see .
- *
- */
-package com.omertron.themoviedbapi.model;
-
-import com.fasterxml.jackson.annotation.JsonAnySetter;
-import com.fasterxml.jackson.annotation.JsonProperty;
-import java.io.Serializable;
-import java.util.List;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- *
- * @author Stuart
- */
-public class MovieChanges implements Serializable {
-
- private static final long serialVersionUID = 1L;
-
- /*
- * Logger
- */
- private static final Logger LOG = LoggerFactory.getLogger(MovieChanges.class);
- /*
- * Properties
- */
- @JsonProperty("key")
- private String key;
- @JsonProperty("items")
- private List items;
-
- //
- public String getKey() {
- return key;
- }
-
- public List getItems() {
- return items;
- }
- //
-
- //
- public void setKey(String key) {
- this.key = key;
- }
-
- public void setItems(List items) {
- this.items = items;
- }
- //
-
- /**
- * Handle unknown properties and print a message
- *
- * @param key
- * @param value
- */
- @JsonAnySetter
- public void handleUnknown(String key, Object value) {
- StringBuilder sb = new StringBuilder();
- sb.append("Unknown property: '").append(key);
- sb.append("' value: '").append(value).append("'");
- LOG.trace(sb.toString());
- }
-}
diff --git a/src/main/java/com/omertron/themoviedbapi/wrapper/WrapperChanges.java b/src/main/java/com/omertron/themoviedbapi/wrapper/WrapperChanges.java
deleted file mode 100644
index ebb5bffbc..000000000
--- a/src/main/java/com/omertron/themoviedbapi/wrapper/WrapperChanges.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * Copyright (c) 2004-2013 Stuart Boston
- *
- * This file is part of TheMovieDB API.
- *
- * TheMovieDB API is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * any later version.
- *
- * TheMovieDB API is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with TheMovieDB API. If not, see .
- *
- */
-package com.omertron.themoviedbapi.wrapper;
-
-import com.fasterxml.jackson.annotation.JsonProperty;
-import com.omertron.themoviedbapi.model.MovieChanges;
-import java.util.List;
-
-/**
- *
- * @author stuart.boston
- */
-public class WrapperChanges extends AbstractWrapper {
-
- @JsonProperty("changes")
- private List changes;
-
- public WrapperChanges() {
- super(WrapperChanges.class);
- }
-
- public List getChanges() {
- return changes;
- }
-
- public void setChanges(List changes) {
- this.changes = changes;
- }
-}
diff --git a/src/test/java/com/omertron/themoviedbapi/TempTest.java b/src/test/java/com/omertron/themoviedbapi/TempTest.java
new file mode 100644
index 000000000..3ae578278
--- /dev/null
+++ b/src/test/java/com/omertron/themoviedbapi/TempTest.java
@@ -0,0 +1,784 @@
+/*
+ * Copyright (c) 2004-2013 Stuart Boston
+ *
+ * This file is part of TheMovieDB API.
+ *
+ * TheMovieDB API is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * any later version.
+ *
+ * TheMovieDB API is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with TheMovieDB API. If not, see .
+ *
+ */
+package com.omertron.themoviedbapi;
+
+import com.omertron.themoviedbapi.model.AlternativeTitle;
+import com.omertron.themoviedbapi.model.Artwork;
+import com.omertron.themoviedbapi.model.Collection;
+import com.omertron.themoviedbapi.model.CollectionInfo;
+import com.omertron.themoviedbapi.model.Company;
+import com.omertron.themoviedbapi.model.Discover;
+import com.omertron.themoviedbapi.model.Genre;
+import com.omertron.themoviedbapi.model.JobDepartment;
+import com.omertron.themoviedbapi.model.Keyword;
+import com.omertron.themoviedbapi.model.KeywordMovie;
+import com.omertron.themoviedbapi.model.MovieChanges;
+import com.omertron.themoviedbapi.model.MovieDb;
+import com.omertron.themoviedbapi.model.MovieDbList;
+import com.omertron.themoviedbapi.model.MovieList;
+import com.omertron.themoviedbapi.model.Person;
+import com.omertron.themoviedbapi.model.PersonCredit;
+import com.omertron.themoviedbapi.model.ReleaseInfo;
+import com.omertron.themoviedbapi.model.Reviews;
+import com.omertron.themoviedbapi.model.TmdbConfiguration;
+import com.omertron.themoviedbapi.model.TokenAuthorisation;
+import com.omertron.themoviedbapi.model.TokenSession;
+import com.omertron.themoviedbapi.model.Trailer;
+import com.omertron.themoviedbapi.model.Translation;
+import com.omertron.themoviedbapi.results.TmdbResultsList;
+import java.io.IOException;
+import org.apache.commons.lang3.StringUtils;
+import org.junit.*;
+import static org.junit.Assert.*;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * Test cases for TheMovieDbApi API
+ *
+ * @author stuart.boston
+ */
+public class TheMovieDbApiTest {
+
+ // Logger
+ private static final Logger LOG = LoggerFactory.getLogger(TheMovieDbApiTest.class);
+ // API Key
+ private static final String API_KEY = "5a1a77e2eba8984804586122754f969f";
+ private static TheMovieDbApi tmdb;
+ // Test data
+ private static final int ID_MOVIE_BLADE_RUNNER = 78;
+ private static final int ID_MOVIE_THE_AVENGERS = 24428;
+ private static final int ID_COLLECTION_STAR_WARS = 10;
+ private static final int ID_PERSON_BRUCE_WILLIS = 62;
+ private static final int ID_COMPANY_LUCASFILM = 1;
+ private static final String COMPANY_NAME = "Marvel Studios";
+ private static final int ID_GENRE_ACTION = 28;
+ private static final String ID_KEYWORD = "1721";
+ // Languages
+ private static final String LANGUAGE_DEFAULT = "";
+ private static final String LANGUAGE_ENGLISH = "en";
+ private static final String LANGUAGE_RUSSIAN = "ru";
+
+ public TheMovieDbApiTest() throws MovieDbException {
+ }
+
+ @BeforeClass
+ public static void setUpClass() throws Exception {
+ tmdb = new TheMovieDbApi(API_KEY);
+ TestLogger.Configure();
+ }
+
+ @AfterClass
+ public static void tearDownClass() throws Exception {
+ }
+
+ @Before
+ public void setUp() {
+ }
+
+ @After
+ public void tearDown() {
+ }
+
+ /**
+ * Test of getConfiguration method, of class TheMovieDbApi.
+ */
+ @Test
+ public void testConfiguration() throws IOException {
+ LOG.info("Test Configuration");
+
+ TmdbConfiguration tmdbConfig = tmdb.getConfiguration();
+ assertNotNull("Configuration failed", tmdbConfig);
+ assertTrue("No base URL", StringUtils.isNotBlank(tmdbConfig.getBaseUrl()));
+ assertTrue("No backdrop sizes", tmdbConfig.getBackdropSizes().size() > 0);
+ assertTrue("No poster sizes", tmdbConfig.getPosterSizes().size() > 0);
+ assertTrue("No profile sizes", tmdbConfig.getProfileSizes().size() > 0);
+ LOG.info(tmdbConfig.toString());
+ }
+
+ /**
+ * Test of searchMovie method, of class TheMovieDbApi.
+ */
+ @Test
+ public void testSearchMovie() throws MovieDbException {
+ LOG.info("searchMovie");
+
+ // Try a movie with less than 1 page of results
+ TmdbResultsList movieList = tmdb.searchMovie("Blade Runner", 0, "", true, 0);
+// List movieList = tmdb.searchMovie("Blade Runner", "", true);
+ assertTrue("No movies found, should be at least 1", movieList.getResults().size() > 0);
+
+ // Try a russian langugage movie
+ movieList = tmdb.searchMovie("О чём говорят мужчины", 0, LANGUAGE_RUSSIAN, true, 0);
+ assertTrue("No 'RU' movies found, should be at least 1", movieList.getResults().size() > 0);
+
+ // Try a movie with more than 20 results
+ movieList = tmdb.searchMovie("Star Wars", 0, LANGUAGE_ENGLISH, false, 0);
+ assertTrue("Not enough movies found, should be over 15, found " + movieList.getResults().size(), movieList.getResults().size() >= 15);
+ }
+
+ /**
+ * Test of getMovieInfo method, of class TheMovieDbApi.
+ */
+ @Test
+ public void testGetMovieInfo() throws MovieDbException {
+ LOG.info("getMovieInfo");
+ MovieDb result = tmdb.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());
+ }
+
+ /**
+ * Test of getMovieAlternativeTitles method, of class TheMovieDbApi.
+ */
+ @Test
+ public void testGetMovieAlternativeTitles() throws MovieDbException {
+ LOG.info("getMovieAlternativeTitles");
+ String country = "";
+ TmdbResultsList result = tmdb.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);
+
+ country = "US";
+ result = tmdb.getMovieAlternativeTitles(ID_MOVIE_BLADE_RUNNER, country);
+ assertTrue("No alternative titles found", result.getResults().size() > 0);
+
+ }
+
+ /**
+ * Test of getMovieCasts method, of class TheMovieDbApi.
+ */
+ @Test
+ public void testGetMovieCasts() throws MovieDbException {
+ LOG.info("getMovieCasts");
+ TmdbResultsList people = tmdb.getMovieCasts(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 (Person 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);
+ }
+
+ /**
+ * Test of getMovieImages method, of class TheMovieDbApi.
+ */
+ @Test
+ public void testGetMovieImages() throws MovieDbException {
+ LOG.info("getMovieImages");
+ String language = "";
+ TmdbResultsList result = tmdb.getMovieImages(ID_MOVIE_BLADE_RUNNER, language);
+ assertFalse("No artwork found", result.getResults().isEmpty());
+ }
+
+ /**
+ * Test of getMovieKeywords method, of class TheMovieDbApi.
+ */
+ @Test
+ public void testGetMovieKeywords() throws MovieDbException {
+ LOG.info("getMovieKeywords");
+ TmdbResultsList result = tmdb.getMovieKeywords(ID_MOVIE_BLADE_RUNNER);
+ assertFalse("No keywords found", result.getResults().isEmpty());
+ }
+
+ /**
+ * Test of getMovieReleaseInfo method, of class TheMovieDbApi.
+ */
+ @Test
+ public void testGetMovieReleaseInfo() throws MovieDbException {
+ LOG.info("getMovieReleaseInfo");
+ TmdbResultsList result = tmdb.getMovieReleaseInfo(ID_MOVIE_BLADE_RUNNER, "");
+ assertFalse("Release information missing", result.getResults().isEmpty());
+ }
+
+ /**
+ * Test of getMovieTrailers method, of class TheMovieDbApi.
+ */
+ @Test
+ public void testGetMovieTrailers() throws MovieDbException {
+ LOG.info("getMovieTrailers");
+ TmdbResultsList result = tmdb.getMovieTrailers(ID_MOVIE_BLADE_RUNNER, "");
+ assertFalse("Movie trailers missing", result.getResults().isEmpty());
+ }
+
+ /**
+ * Test of getMovieTranslations method, of class TheMovieDbApi.
+ */
+ @Test
+ public void testGetMovieTranslations() throws MovieDbException {
+ LOG.info("getMovieTranslations");
+ TmdbResultsList result = tmdb.getMovieTranslations(ID_MOVIE_BLADE_RUNNER);
+ assertFalse("No translations found", result.getResults().isEmpty());
+ }
+
+ /**
+ * Test of getCollectionInfo method, of class TheMovieDbApi.
+ */
+ @Test
+ public void testGetCollectionInfo() throws MovieDbException {
+ LOG.info("getCollectionInfo");
+ String language = "";
+ CollectionInfo result = tmdb.getCollectionInfo(ID_COLLECTION_STAR_WARS, language);
+ assertFalse("No collection information", result.getParts().isEmpty());
+ }
+
+ /**
+ * Test of createImageUrl method, of class TheMovieDbApi.
+ *
+ * @throws MovieDbException
+ */
+ @Test
+ public void testCreateImageUrl() throws MovieDbException {
+ LOG.info("createImageUrl");
+ MovieDb movie = tmdb.getMovieInfo(ID_MOVIE_BLADE_RUNNER, "");
+ String result = tmdb.createImageUrl(movie.getPosterPath(), "original").toString();
+ assertTrue("Error compiling image URL", !result.isEmpty());
+ }
+
+ /**
+ * Test of getMovieInfoImdb method, of class TheMovieDbApi.
+ */
+ @Test
+ public void testGetMovieInfoImdb() throws MovieDbException {
+ LOG.info("getMovieInfoImdb");
+ MovieDb result = tmdb.getMovieInfoImdb("tt0076759", "en-US");
+ assertTrue("Error getting the movie from IMDB ID", result.getId() == 11);
+ }
+
+ /**
+ * Test of getApiKey method, of class TheMovieDbApi.
+ */
+ @Test
+ public void testGetApiKey() {
+ // Not required
+ }
+
+ /**
+ * Test of getApiBase method, of class TheMovieDbApi.
+ */
+ @Test
+ public void testGetApiBase() {
+ // Not required
+ }
+
+ /**
+ * Test of getConfiguration method, of class TheMovieDbApi.
+ */
+ @Test
+ public void testGetConfiguration() {
+ // Not required
+ }
+
+ /**
+ * Test of searchPeople method, of class TheMovieDbApi.
+ */
+ @Test
+ public void testSearchPeople() throws MovieDbException {
+ LOG.info("searchPeople");
+ String personName = "Bruce Willis";
+ boolean includeAdult = false;
+ TmdbResultsList result = tmdb.searchPeople(personName, includeAdult, 0);
+ assertTrue("Couldn't find the person", result.getResults().size() > 0);
+ }
+
+ /**
+ * Test of getPersonInfo method, of class TheMovieDbApi.
+ */
+ @Test
+ public void testGetPersonInfo() throws MovieDbException {
+ LOG.info("getPersonInfo");
+ Person result = tmdb.getPersonInfo(ID_PERSON_BRUCE_WILLIS);
+ assertTrue("Wrong actor returned", result.getId() == ID_PERSON_BRUCE_WILLIS);
+ }
+
+ /**
+ * Test of getPersonCredits method, of class TheMovieDbApi.
+ */
+ @Test
+ public void testGetPersonCredits() throws MovieDbException {
+ LOG.info("getPersonCredits");
+
+ TmdbResultsList result = tmdb.getPersonCredits(ID_PERSON_BRUCE_WILLIS);
+ assertTrue("No cast information", result.getResults().size() > 0);
+ }
+
+ /**
+ * Test of getPersonImages method, of class TheMovieDbApi.
+ */
+ @Test
+ public void testGetPersonImages() throws MovieDbException {
+ LOG.info("getPersonImages");
+
+ TmdbResultsList result = tmdb.getPersonImages(ID_PERSON_BRUCE_WILLIS);
+ assertTrue("No cast information", result.getResults().size() > 0);
+ }
+
+ /**
+ * Test of getLatestMovie method, of class TheMovieDbApi.
+ */
+ @Test
+ public void testGetLatestMovie() throws MovieDbException {
+ LOG.info("getLatestMovie");
+ MovieDb result = tmdb.getLatestMovie();
+ assertTrue("No latest movie found", result != null);
+ assertTrue("No latest movie found", result.getId() > 0);
+ }
+
+ /**
+ * Test of compareMovies method, of class TheMovieDbApi.
+ */
+ @Test
+ public void testCompareMovies() {
+ // Not required
+ }
+
+ /**
+ * Test of setProxy method, of class TheMovieDbApi.
+ */
+ @Test
+ public void testSetProxy() {
+ // Not required
+ }
+
+ /**
+ * Test of setTimeout method, of class TheMovieDbApi.
+ */
+ @Test
+ public void testSetTimeout() {
+ // Not required
+ }
+
+ /**
+ * Test of getNowPlayingMovies method, of class TheMovieDbApi.
+ */
+ @Test
+ public void testGetNowPlayingMovies() throws MovieDbException {
+ LOG.info("getNowPlayingMovies");
+ TmdbResultsList result = tmdb.getNowPlayingMovies(LANGUAGE_DEFAULT, 0);
+ assertTrue("No now playing movies found", !result.getResults().isEmpty());
+ }
+
+ /**
+ * Test of getPopularMovieList method, of class TheMovieDbApi.
+ */
+ @Test
+ public void testGetPopularMovieList() throws MovieDbException {
+ LOG.info("getPopularMovieList");
+ TmdbResultsList result = tmdb.getPopularMovieList(LANGUAGE_DEFAULT, 0);
+ assertTrue("No popular movies found", !result.getResults().isEmpty());
+ }
+
+ /**
+ * Test of getTopRatedMovies method, of class TheMovieDbApi.
+ */
+ @Test
+ public void testGetTopRatedMovies() throws MovieDbException {
+ LOG.info("getTopRatedMovies");
+ TmdbResultsList result = tmdb.getTopRatedMovies(LANGUAGE_DEFAULT, 0);
+ assertTrue("No top rated movies found", !result.getResults().isEmpty());
+ }
+
+ /**
+ * Test of getCompanyInfo method, of class TheMovieDbApi.
+ */
+ @Test
+ public void testGetCompanyInfo() throws MovieDbException {
+ LOG.info("getCompanyInfo");
+ Company company = tmdb.getCompanyInfo(ID_COMPANY_LUCASFILM);
+ assertTrue("No company information found", company.getCompanyId() > 0);
+ }
+
+ /**
+ * Test of getCompanyMovies method, of class TheMovieDbApi.
+ */
+ @Test
+ public void testGetCompanyMovies() throws MovieDbException {
+ LOG.info("getCompanyMovies");
+ TmdbResultsList result = tmdb.getCompanyMovies(ID_COMPANY_LUCASFILM, LANGUAGE_DEFAULT, 0);
+ assertTrue("No company movies found", !result.getResults().isEmpty());
+ }
+
+ /**
+ * Test of searchCompanies method, of class TheMovieDbApi.
+ */
+ @Test
+ public void testSearchCompanies() throws MovieDbException {
+ LOG.info("searchCompanies");
+ TmdbResultsList result = tmdb.searchCompanies(COMPANY_NAME, 0);
+ assertTrue("No company information found", !result.getResults().isEmpty());
+ }
+
+ /**
+ * Test of getSimilarMovies method, of class TheMovieDbApi.
+ */
+ @Test
+ public void testGetSimilarMovies() throws MovieDbException {
+ LOG.info("getSimilarMovies");
+ TmdbResultsList result = tmdb.getSimilarMovies(ID_MOVIE_BLADE_RUNNER, LANGUAGE_DEFAULT, 0);
+ assertTrue("No similar movies found", !result.getResults().isEmpty());
+ }
+
+ /**
+ * Test of getGenreList method, of class TheMovieDbApi.
+ */
+ @Test
+ public void testGetGenreList() throws MovieDbException {
+ LOG.info("getGenreList");
+ TmdbResultsList result = tmdb.getGenreList(LANGUAGE_DEFAULT);
+ assertTrue("No genres found", !result.getResults().isEmpty());
+ }
+
+ /**
+ * Test of getGenreMovies method, of class TheMovieDbApi.
+ */
+ @Test
+ public void testGetGenreMovies() throws MovieDbException {
+ LOG.info("getGenreMovies");
+ TmdbResultsList result = tmdb.getGenreMovies(ID_GENRE_ACTION, LANGUAGE_DEFAULT, 0, Boolean.TRUE);
+ assertTrue("No genre movies found", !result.getResults().isEmpty());
+ }
+
+ /**
+ * Test of getUpcoming method, of class TheMovieDbApi.
+ */
+ @Test
+ public void testGetUpcoming() throws Exception {
+ LOG.info("getUpcoming");
+ TmdbResultsList result = tmdb.getUpcoming(LANGUAGE_DEFAULT, 0);
+ assertTrue("No upcoming movies found", !result.getResults().isEmpty());
+ }
+
+ /**
+ * Test of getCollectionImages method, of class TheMovieDbApi.
+ */
+ @Test
+ public void testGetCollectionImages() throws Exception {
+ LOG.info("getCollectionImages");
+ TmdbResultsList result = tmdb.getCollectionImages(ID_COLLECTION_STAR_WARS, LANGUAGE_DEFAULT);
+ assertFalse("No artwork found", result.getResults().isEmpty());
+ }
+
+ /**
+ * Test of getAuthorisationToken method, of class TheMovieDbApi.
+ */
+ @Test
+ public void testGetAuthorisationToken() throws Exception {
+ LOG.info("getAuthorisationToken");
+ TokenAuthorisation result = tmdb.getAuthorisationToken();
+ assertFalse("Token is null", result == null);
+ assertTrue("Token is not valid", result.getSuccess());
+ LOG.info(result.toString());
+ }
+
+ /**
+ * Test of getSessionToken method, of class TheMovieDbApi.
+ *
+ * TODO: Cannot be tested without a HTTP authorisation: http://help.themoviedb.org/kb/api/user-authentication
+ */
+ public void testGetSessionToken() throws Exception {
+ LOG.info("getSessionToken");
+ TokenAuthorisation token = tmdb.getAuthorisationToken();
+ assertFalse("Token is null", token == null);
+ assertTrue("Token is not valid", token.getSuccess());
+ LOG.info(token.toString());
+
+ TokenSession result = tmdb.getSessionToken(token);
+ assertFalse("Session token is null", result == null);
+ assertTrue("Session token is not valid", result.getSuccess());
+ LOG.info(result.toString());
+ }
+
+ /**
+ * Test of getGuestSessionToken method, of class TheMovieDbApi.
+ */
+ @Ignore("Not ready yet")
+ public void testGetGuestSessionToken() throws Exception {
+ LOG.info("getGuestSessionToken");
+ TokenSession result = tmdb.getGuestSessionToken();
+
+ assertTrue("Failed to get guest session", result.getSuccess());
+ }
+
+ @Test
+ public void testGetMovieLists() throws Exception {
+ LOG.info("getMovieLists");
+ TmdbResultsList result = tmdb.getMovieLists(ID_MOVIE_BLADE_RUNNER, LANGUAGE_ENGLISH, 0);
+ assertNotNull("No results found", result);
+ assertTrue("No results found", result.getResults().size() > 0);
+ }
+
+ /**
+ * Test of getMovieChanges method,of class TheMovieDbApi
+ *
+ * TODO: Do not test this until it is fixed
+ */
+ public void testGetMovieChanges() throws Exception {
+ LOG.info("getMovieChanges");
+
+ String startDate = "";
+ String endDate = null;
+
+ // Get some popular movies
+ TmdbResultsList movieList = tmdb.getPopularMovieList(LANGUAGE_DEFAULT, 0);
+ for (MovieDb movie : movieList.getResults()) {
+ TmdbResultsList result = tmdb.getMovieChanges(movie.getId(), startDate, endDate);
+ LOG.info("{} has {} changes.", new Object[]{movie.getTitle(), result.getResults().size()});
+ }
+
+ assertNotNull("No results found", movieList.getResults());
+ assertTrue("No results found", movieList.getResults().size() > 0);
+ }
+
+ @Test
+ public void testGetPersonLatest() throws Exception {
+ LOG.info("getPersonLatest");
+
+ Person result = tmdb.getPersonLatest();
+
+ assertNotNull("No results found", result);
+ assertTrue("No results found", StringUtils.isNotBlank(result.getName()));
+ }
+
+ /**
+ * Test of searchCollection method, of class TheMovieDbApi.
+ */
+ @Test
+ public void testSearchCollection() throws Exception {
+ LOG.info("searchCollection");
+ String query = "batman";
+ int page = 0;
+ TmdbResultsList result = tmdb.searchCollection(query, LANGUAGE_DEFAULT, page);
+ assertFalse("No collections found", result == null);
+ assertTrue("No collections found", result.getResults().size() > 0);
+ }
+
+ /**
+ * Test of searchList method, of class TheMovieDbApi.
+ */
+ @Test
+ public void testSearchList() throws Exception {
+ LOG.info("searchList");
+ String query = "watch";
+ int page = 0;
+ TmdbResultsList result = tmdb.searchList(query, LANGUAGE_DEFAULT, page);
+ assertFalse("No lists found", result.getResults() == null);
+ assertTrue("No lists found", result.getResults().size() > 0);
+ }
+
+ /**
+ * Test of searchKeyword method, of class TheMovieDbApi.
+ */
+ @Test
+ public void testSearchKeyword() throws Exception {
+ LOG.info("searchKeyword");
+ String query = "action";
+ int page = 0;
+ TmdbResultsList result = tmdb.searchKeyword(query, page);
+ assertFalse("No keywords found", result.getResults() == null);
+ assertTrue("No keywords found", result.getResults().size() > 0);
+ }
+
+ /**
+ * Test of postMovieRating method, of class TheMovieDbApi.
+ *
+ * TODO: Cannot be tested without a HTTP authorisation: http://help.themoviedb.org/kb/api/user-authentication
+ */
+ @Ignore("Not ready yet")
+ public void testPostMovieRating() throws Exception {
+ LOG.info("postMovieRating");
+ String sessionId = "";
+ String rating = "";
+ boolean expResult = false;
+ boolean result = tmdb.postMovieRating(sessionId, rating);
+ assertEquals(expResult, result);
+ // TODO review the generated test code and remove the default call to fail.
+ fail("The test case is a prototype.");
+ }
+
+ /**
+ * Test of getPersonChanges method, of class TheMovieDbApi.
+ *
+ */
+ @Ignore("Not ready yet")
+ public void testGetPersonChanges() throws Exception {
+ LOG.info("getPersonChanges");
+ String startDate = "";
+ String endDate = "";
+ tmdb.getPersonChanges(ID_PERSON_BRUCE_WILLIS, startDate, endDate);
+ }
+
+ /**
+ * Test of getList method, of class TheMovieDbApi.
+ */
+ @Test
+ public void testGetList() throws Exception {
+ LOG.info("getList");
+ String listId = "509ec17b19c2950a0600050d";
+ MovieDbList result = tmdb.getList(listId);
+ assertFalse("List not found", result.getItems().isEmpty());
+ }
+
+ /**
+ * Test of getKeyword method, of class TheMovieDbApi.
+ */
+ @Test
+ public void testGetKeyword() throws Exception {
+ LOG.info("getKeyword");
+ Keyword result = tmdb.getKeyword(ID_KEYWORD);
+ assertEquals("fight", result.getName());
+ }
+
+ /**
+ * Test of getKeywordMovies method, of class TheMovieDbApi.
+ */
+ @Test
+ public void testGetKeywordMovies() throws Exception {
+ LOG.info("getKeywordMovies");
+ int page = 0;
+ TmdbResultsList result = tmdb.getKeywordMovies(ID_KEYWORD, LANGUAGE_DEFAULT, page);
+ assertFalse("No keyword movies found", result.getResults().isEmpty());
+ }
+
+ /**
+ * Test of getReviews method, of class TheMovieDbApi.
+ */
+ @Test
+ public void testGetReviews() throws Exception {
+ LOG.info("getReviews");
+ int page = 0;
+ TmdbResultsList result = tmdb.getReviews(ID_MOVIE_THE_AVENGERS, LANGUAGE_DEFAULT, page);
+
+ assertFalse("No reviews found", result.getResults().isEmpty());
+ }
+
+ /**
+ * Test of compareMovies method, of class TheMovieDbApi.
+ */
+ @Ignore("Not required")
+ public void testCompareMovies_3args() {
+ }
+
+ /**
+ * Test of compareMovies method, of class TheMovieDbApi.
+ */
+ @Ignore("Not required")
+ public void testCompareMovies_4args() {
+ }
+
+ /**
+ * Test of getPersonPopular method, of class TheMovieDbApi.
+ */
+ @Ignore("Not required")
+ public void testGetPersonPopular_0args() throws Exception {
+ }
+
+ /**
+ * Test of getPersonPopular method, of class TheMovieDbApi.
+ */
+ @Test
+ public void testGetPersonPopular_int() throws Exception {
+ LOG.info("getPersonPopular");
+ int page = 0;
+ TmdbResultsList result = tmdb.getPersonPopular(page);
+ assertFalse("No popular people", result.getResults().isEmpty());
+ }
+
+ /**
+ * Test of getGenreMovies method, of class TheMovieDbApi.
+ */
+ @Ignore("Not required")
+ public void testGetGenreMovies_3args() throws Exception {
+ }
+
+ /**
+ * Test of getGenreMovies method, of class TheMovieDbApi.
+ */
+ @Ignore("Not required")
+ public void testGetGenreMovies_4args() throws Exception {
+ }
+
+ /**
+ * Test of getMovieChangesList method, of class TheMovieDbApi.
+ */
+ @Ignore("Not ready yet")
+ public void testGetMovieChangesList() throws Exception {
+ LOG.info("getMovieChangesList");
+ int page = 0;
+ String startDate = "";
+ String endDate = "";
+ tmdb.getMovieChangesList(page, startDate, endDate);
+ // TODO review the generated test code and remove the default call to fail.
+ fail("The test case is a prototype.");
+ }
+
+ /**
+ * Test of getPersonChangesList method, of class TheMovieDbApi.
+ */
+ @Ignore("Not ready yet")
+ public void testGetPersonChangesList() throws Exception {
+ LOG.info("getPersonChangesList");
+ int page = 0;
+ String startDate = "";
+ String endDate = "";
+ tmdb.getPersonChangesList(page, startDate, endDate);
+ // TODO review the generated test code and remove the default call to fail.
+ fail("The test case is a prototype.");
+ }
+
+ /**
+ * Test of getJobs method, of class TheMovieDbApi.
+ */
+ @Test
+ public void testGetJobs() throws Exception {
+ LOG.info("getJobs");
+ TmdbResultsList result = tmdb.getJobs();
+ assertFalse("No jobs found", result.getResults().isEmpty());
+ }
+
+ /**
+ * Test of getDiscover method, of class TheMovieDbApi.
+ */
+ @Ignore("Not required")
+ public void testGetDiscover_14args() throws Exception {
+ }
+
+ /**
+ * Test of getDiscover method, of class TheMovieDbApi.
+ */
+ @Test
+ public void testGetDiscover_Discover() throws Exception {
+ LOG.info("getDiscover");
+ Discover discover = new Discover();
+ discover.year(2013).language(LANGUAGE_ENGLISH);
+
+ TmdbResultsList result = tmdb.getDiscover(discover);
+ assertFalse("No movies discovered", result.getResults().isEmpty());
+ }
+}