diff --git a/src/main/java/com/omertron/themoviedbapi/TheMovieDbApi.java b/src/main/java/com/omertron/themoviedbapi/TheMovieDbApi.java index ff76fc166..cbb0753b6 100644 --- a/src/main/java/com/omertron/themoviedbapi/TheMovieDbApi.java +++ b/src/main/java/com/omertron/themoviedbapi/TheMovieDbApi.java @@ -69,8 +69,8 @@ import com.omertron.themoviedbapi.model2.authentication.TokenAuthorisation; import com.omertron.themoviedbapi.model2.authentication.TokenSession; import com.omertron.themoviedbapi.model.Translation; import com.omertron.themoviedbapi.model.Video; -import com.omertron.themoviedbapi.model2.movie.MovieFavorite; -import com.omertron.themoviedbapi.model2.tv.TVFavorite; +import com.omertron.themoviedbapi.model2.movie.MovieBasic; +import com.omertron.themoviedbapi.model2.tv.TVBasic; import com.omertron.themoviedbapi.model2.list.UserList; import com.omertron.themoviedbapi.results.TmdbResultsList; import com.omertron.themoviedbapi.results.TmdbResultsMap; @@ -295,7 +295,7 @@ public class TheMovieDbApi { * @return * @throws MovieDbException */ - public List getFavoriteMovies(String sessionId, int accountId) throws MovieDbException { + public List getFavoriteMovies(String sessionId, int accountId) throws MovieDbException { return tmdbAccount.getFavoriteMovies(sessionId, accountId); } @@ -325,7 +325,7 @@ public class TheMovieDbApi { * @return * @throws MovieDbException */ - public List getRatedMovies(String sessionId, int accountId, Integer page, String sortBy, String language) throws MovieDbException { + public List getRatedMovies(String sessionId, int accountId, Integer page, String sortBy, String language) throws MovieDbException { return tmdbAccount.getRatedMovies(sessionId, accountId, page, sortBy, language); } @@ -340,7 +340,7 @@ public class TheMovieDbApi { * @return * @throws MovieDbException */ - public List getRatedTV(String sessionId, int accountId, Integer page, String sortBy, String language) throws MovieDbException { + public List getRatedTV(String sessionId, int accountId, Integer page, String sortBy, String language) throws MovieDbException { return tmdbAccount.getRatedTV(sessionId, accountId, page, sortBy, language); } @@ -355,7 +355,7 @@ public class TheMovieDbApi { * @return The watchlist of the user * @throws MovieDbException */ - public List getWatchListMovie(String sessionId, int accountId, Integer page, String sortBy, String language) throws MovieDbException { + public List getWatchListMovie(String sessionId, int accountId, Integer page, String sortBy, String language) throws MovieDbException { return tmdbAccount.getWatchListMovie(sessionId, accountId, page, sortBy, language); } @@ -370,7 +370,7 @@ public class TheMovieDbApi { * @return The watchlist of the user * @throws MovieDbException */ - public List getWatchListTV(String sessionId, int accountId, Integer page, String sortBy, String language) throws MovieDbException { + public List getWatchListTV(String sessionId, int accountId, Integer page, String sortBy, String language) throws MovieDbException { return tmdbAccount.getWatchListTV(sessionId, accountId, page, sortBy, language); } @@ -602,7 +602,7 @@ public class TheMovieDbApi { * @return * @throws MovieDbException */ - public List getCompanyMovies(int companyId, String language, int page) throws MovieDbException { + public List getCompanyMovies(int companyId, String language, int page) throws MovieDbException { return tmdbCompany.getCompanyMovies(companyId, language, page); } // diff --git a/src/main/java/com/omertron/themoviedbapi/methods/AbstractMethod.java b/src/main/java/com/omertron/themoviedbapi/methods/AbstractMethod.java index ca4feb1f5..11dc8fd5d 100644 --- a/src/main/java/com/omertron/themoviedbapi/methods/AbstractMethod.java +++ b/src/main/java/com/omertron/themoviedbapi/methods/AbstractMethod.java @@ -22,8 +22,8 @@ package com.omertron.themoviedbapi.methods; import com.fasterxml.jackson.core.type.TypeReference; import com.fasterxml.jackson.databind.ObjectMapper; import com.omertron.themoviedbapi.MovieDbException; -import com.omertron.themoviedbapi.model2.movie.MovieFavorite; -import com.omertron.themoviedbapi.model2.tv.TVFavorite; +import com.omertron.themoviedbapi.model2.movie.MovieBasic; +import com.omertron.themoviedbapi.model2.tv.TVBasic; import com.omertron.themoviedbapi.model2.list.UserList; import com.omertron.themoviedbapi.tools.HttpTools; import com.omertron.themoviedbapi.wrapper.WrapperGenericList; @@ -49,9 +49,9 @@ public class AbstractMethod { protected static final ObjectMapper MAPPER = new ObjectMapper(); // Logger protected static final Logger LOG = LoggerFactory.getLogger(TmdbAccount.class); - protected static final TypeReference> TR_MOVIE_FAV = new TypeReference>() { + protected static final TypeReference> TR_MOVIE_BASIC = new TypeReference>() { }; - protected static final TypeReference> TR_TV_FAV = new TypeReference>() { + protected static final TypeReference> TR_TV_BASIC = new TypeReference>() { }; protected static final TypeReference> TR_USER_LIST = new TypeReference>() { }; diff --git a/src/main/java/com/omertron/themoviedbapi/methods/TmdbAccount.java b/src/main/java/com/omertron/themoviedbapi/methods/TmdbAccount.java index 1e5513bcc..22574f209 100644 --- a/src/main/java/com/omertron/themoviedbapi/methods/TmdbAccount.java +++ b/src/main/java/com/omertron/themoviedbapi/methods/TmdbAccount.java @@ -23,8 +23,8 @@ import com.omertron.themoviedbapi.MovieDbException; import com.omertron.themoviedbapi.enumeration.MediaType; import com.omertron.themoviedbapi.model2.account.Account; import com.omertron.themoviedbapi.model2.StatusCode; -import com.omertron.themoviedbapi.model2.movie.MovieFavorite; -import com.omertron.themoviedbapi.model2.tv.TVFavorite; +import com.omertron.themoviedbapi.model2.movie.MovieBasic; +import com.omertron.themoviedbapi.model2.tv.TVBasic; import com.omertron.themoviedbapi.model2.list.UserList; import com.omertron.themoviedbapi.tools.ApiUrl; import com.omertron.themoviedbapi.tools.HttpTools; @@ -102,13 +102,13 @@ public class TmdbAccount extends AbstractMethod { * @return * @throws MovieDbException */ - public List getFavoriteMovies(String sessionId, int accountId) throws MovieDbException { + public List getFavoriteMovies(String sessionId, int accountId) throws MovieDbException { TmdbParameters parameters = new TmdbParameters(); parameters.add(Param.SESSION, sessionId); parameters.add(Param.ID, accountId); URL url = new ApiUrl(apiKey, MethodBase.ACCOUNT).setSubMethod(MethodSub.FAVORITE_MOVIES).buildUrl(parameters); - return processWrapperList(TR_MOVIE_FAV, url, "favorite movies"); + return processWrapperList(TR_MOVIE_BASIC, url, "favorite movies"); } /** @@ -119,13 +119,13 @@ public class TmdbAccount extends AbstractMethod { * @return * @throws MovieDbException */ - public List getFavoriteTv(String sessionId, int accountId) throws MovieDbException { + public List getFavoriteTv(String sessionId, int accountId) throws MovieDbException { TmdbParameters parameters = new TmdbParameters(); parameters.add(Param.SESSION, sessionId); parameters.add(Param.ID, accountId); URL url = new ApiUrl(apiKey, MethodBase.ACCOUNT).setSubMethod(MethodSub.FAVORITE_TV).buildUrl(parameters); - return processWrapperList(TR_TV_FAV, url, "favorite TV shows"); + return processWrapperList(TR_TV_BASIC, url, "favorite TV shows"); } /** @@ -171,7 +171,7 @@ public class TmdbAccount extends AbstractMethod { * @return * @throws MovieDbException */ - public List getRatedMovies(String sessionId, int accountId, Integer page, String sortBy, String language) throws MovieDbException { + public List getRatedMovies(String sessionId, int accountId, Integer page, String sortBy, String language) throws MovieDbException { TmdbParameters parameters = new TmdbParameters(); parameters.add(Param.SESSION, sessionId); parameters.add(Param.ID, accountId); @@ -180,7 +180,7 @@ public class TmdbAccount extends AbstractMethod { parameters.add(Param.LANGUAGE, language); URL url = new ApiUrl(apiKey, MethodBase.ACCOUNT).setSubMethod(MethodSub.RATED_MOVIES).buildUrl(parameters); - return processWrapperList(TR_MOVIE_FAV, url, "rated movies"); + return processWrapperList(TR_MOVIE_BASIC, url, "rated movies"); } /** @@ -194,7 +194,7 @@ public class TmdbAccount extends AbstractMethod { * @return * @throws MovieDbException */ - public List getRatedTV(String sessionId, int accountId, Integer page, String sortBy, String language) throws MovieDbException { + public List getRatedTV(String sessionId, int accountId, Integer page, String sortBy, String language) throws MovieDbException { TmdbParameters parameters = new TmdbParameters(); parameters.add(Param.SESSION, sessionId); parameters.add(Param.ID, accountId); @@ -203,7 +203,7 @@ public class TmdbAccount extends AbstractMethod { parameters.add(Param.LANGUAGE, language); URL url = new ApiUrl(apiKey, MethodBase.ACCOUNT).setSubMethod(MethodSub.RATED_TV).buildUrl(parameters); - return processWrapperList(TR_TV_FAV, url, "rated TV shows"); + return processWrapperList(TR_TV_BASIC, url, "rated TV shows"); } /** @@ -217,7 +217,7 @@ public class TmdbAccount extends AbstractMethod { * @return The watch list of the user * @throws MovieDbException */ - public List getWatchListMovie(String sessionId, int accountId, Integer page, String sortBy, String language) throws MovieDbException { + public List getWatchListMovie(String sessionId, int accountId, Integer page, String sortBy, String language) throws MovieDbException { TmdbParameters parameters = new TmdbParameters(); parameters.add(Param.SESSION, sessionId); parameters.add(Param.ID, accountId); @@ -226,7 +226,7 @@ public class TmdbAccount extends AbstractMethod { parameters.add(Param.LANGUAGE, language); URL url = new ApiUrl(apiKey, MethodBase.ACCOUNT).setSubMethod(MethodSub.WATCHLIST_MOVIES).buildUrl(parameters); - return processWrapperList(TR_MOVIE_FAV, url, "movie watch list"); + return processWrapperList(TR_MOVIE_BASIC, url, "movie watch list"); } /** @@ -240,7 +240,7 @@ public class TmdbAccount extends AbstractMethod { * @return The watch list of the user * @throws MovieDbException */ - public List getWatchListTV(String sessionId, int accountId, Integer page, String sortBy, String language) throws MovieDbException { + public List getWatchListTV(String sessionId, int accountId, Integer page, String sortBy, String language) throws MovieDbException { TmdbParameters parameters = new TmdbParameters(); parameters.add(Param.SESSION, sessionId); parameters.add(Param.ID, accountId); @@ -249,7 +249,7 @@ public class TmdbAccount extends AbstractMethod { parameters.add(Param.LANGUAGE, language); URL url = new ApiUrl(apiKey, MethodBase.ACCOUNT).setSubMethod(MethodSub.WATCHLIST_TV).buildUrl(parameters); - return processWrapperList(TR_TV_FAV, url, "TV watch list"); + return processWrapperList(TR_TV_BASIC, url, "TV watch list"); } /** diff --git a/src/main/java/com/omertron/themoviedbapi/methods/TmdbCompanies.java b/src/main/java/com/omertron/themoviedbapi/methods/TmdbCompanies.java index a92e2bb14..d03571ccd 100644 --- a/src/main/java/com/omertron/themoviedbapi/methods/TmdbCompanies.java +++ b/src/main/java/com/omertron/themoviedbapi/methods/TmdbCompanies.java @@ -21,7 +21,7 @@ package com.omertron.themoviedbapi.methods; import com.omertron.themoviedbapi.MovieDbException; import com.omertron.themoviedbapi.model2.company.Company; -import com.omertron.themoviedbapi.model2.movie.MovieFavorite; +import com.omertron.themoviedbapi.model2.movie.MovieBasic; import com.omertron.themoviedbapi.tools.ApiUrl; import com.omertron.themoviedbapi.tools.HttpTools; import com.omertron.themoviedbapi.tools.MethodBase; @@ -84,7 +84,7 @@ public class TmdbCompanies extends AbstractMethod { * @return * @throws MovieDbException */ - public List getCompanyMovies(int companyId, String language, Integer page) throws MovieDbException { + public List getCompanyMovies(int companyId, String language, Integer page) throws MovieDbException { TmdbParameters parameters = new TmdbParameters(); parameters.add(Param.ID, companyId); parameters.add(Param.LANGUAGE, language); @@ -92,7 +92,7 @@ public class TmdbCompanies extends AbstractMethod { URL url = new ApiUrl(apiKey, MethodBase.COMPANY).setSubMethod(MethodSub.MOVIES).buildUrl(parameters); String webpage = httpTools.getRequest(url); - return processWrapperList(TR_MOVIE_FAV, url, webpage); + return processWrapperList(TR_MOVIE_BASIC, url, webpage); } } diff --git a/src/main/java/com/omertron/themoviedbapi/model2/movie/MovieFavorite.java b/src/main/java/com/omertron/themoviedbapi/model2/movie/MovieBasic.java similarity index 98% rename from src/main/java/com/omertron/themoviedbapi/model2/movie/MovieFavorite.java rename to src/main/java/com/omertron/themoviedbapi/model2/movie/MovieBasic.java index eac5c7c05..55357bdba 100644 --- a/src/main/java/com/omertron/themoviedbapi/model2/movie/MovieFavorite.java +++ b/src/main/java/com/omertron/themoviedbapi/model2/movie/MovieBasic.java @@ -28,7 +28,7 @@ import com.fasterxml.jackson.annotation.JsonProperty; * * @author stuart.boston */ -public class MovieFavorite extends AbstractJsonMapping { +public class MovieBasic extends AbstractJsonMapping { @JsonProperty("id") private int id; diff --git a/src/main/java/com/omertron/themoviedbapi/model2/tv/TVFavorite.java b/src/main/java/com/omertron/themoviedbapi/model2/tv/TVBasic.java similarity index 98% rename from src/main/java/com/omertron/themoviedbapi/model2/tv/TVFavorite.java rename to src/main/java/com/omertron/themoviedbapi/model2/tv/TVBasic.java index 8e70360d2..85399f3a5 100644 --- a/src/main/java/com/omertron/themoviedbapi/model2/tv/TVFavorite.java +++ b/src/main/java/com/omertron/themoviedbapi/model2/tv/TVBasic.java @@ -29,7 +29,7 @@ import java.util.List; * * @author stuart.boston */ -public class TVFavorite extends AbstractJsonMapping { +public class TVBasic extends AbstractJsonMapping { @JsonProperty("id") private int id; diff --git a/src/main/java/com/omertron/themoviedbapi/wrapper/WrapperCompanyMovies.java b/src/main/java/com/omertron/themoviedbapi/wrapper/WrapperCompanyMovies.java index 5f636882b..2715332fe 100644 --- a/src/main/java/com/omertron/themoviedbapi/wrapper/WrapperCompanyMovies.java +++ b/src/main/java/com/omertron/themoviedbapi/wrapper/WrapperCompanyMovies.java @@ -20,7 +20,7 @@ package com.omertron.themoviedbapi.wrapper; import com.fasterxml.jackson.annotation.JsonProperty; -import com.omertron.themoviedbapi.model2.movie.MovieFavorite; +import com.omertron.themoviedbapi.model2.movie.MovieBasic; import java.util.List; /** @@ -30,13 +30,13 @@ import java.util.List; public class WrapperCompanyMovies extends AbstractWrapperAll { @JsonProperty("results") - private List results; + private List results; - public List getResults() { + public List getResults() { return results; } - public void setResults(List results) { + public void setResults(List results) { this.results = results; } } diff --git a/src/test/java/com/omertron/themoviedbapi/TheMovieDbApiTest.java b/src/test/java/com/omertron/themoviedbapi/TheMovieDbApiTest.java index e05a5c4f6..de575d792 100644 --- a/src/test/java/com/omertron/themoviedbapi/TheMovieDbApiTest.java +++ b/src/test/java/com/omertron/themoviedbapi/TheMovieDbApiTest.java @@ -42,7 +42,9 @@ import com.omertron.themoviedbapi.model2.authentication.TokenAuthorisation; import com.omertron.themoviedbapi.model2.authentication.TokenSession; import com.omertron.themoviedbapi.model.Translation; import com.omertron.themoviedbapi.model.Video; +import com.omertron.themoviedbapi.model2.movie.MovieBasic; import com.omertron.themoviedbapi.results.TmdbResultsList; +import java.util.List; import org.apache.commons.lang3.StringUtils; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; @@ -400,8 +402,8 @@ public class TheMovieDbApiTest extends AbstractTests { @Test public void testGetCompanyMovies() throws MovieDbException { LOG.info("getCompanyMovies"); - TmdbResultsList result = tmdb.getCompanyMovies(ID_COMPANY, LANGUAGE_DEFAULT, 0); - assertTrue("No company movies found", !result.getResults().isEmpty()); + List result = tmdb.getCompanyMovies(ID_COMPANY, LANGUAGE_DEFAULT, 0); + assertFalse("No company movies found", result.isEmpty()); } /** diff --git a/src/test/java/com/omertron/themoviedbapi/methods/TmdbAccountTest.java b/src/test/java/com/omertron/themoviedbapi/methods/TmdbAccountTest.java index 5ed8712e5..229807fa3 100644 --- a/src/test/java/com/omertron/themoviedbapi/methods/TmdbAccountTest.java +++ b/src/test/java/com/omertron/themoviedbapi/methods/TmdbAccountTest.java @@ -24,8 +24,8 @@ import com.omertron.themoviedbapi.MovieDbException; import com.omertron.themoviedbapi.enumeration.MediaType; import com.omertron.themoviedbapi.model2.account.Account; import com.omertron.themoviedbapi.model2.StatusCode; -import com.omertron.themoviedbapi.model2.movie.MovieFavorite; -import com.omertron.themoviedbapi.model2.tv.TVFavorite; +import com.omertron.themoviedbapi.model2.movie.MovieBasic; +import com.omertron.themoviedbapi.model2.tv.TVBasic; import com.omertron.themoviedbapi.model2.list.UserList; import java.util.List; import org.junit.After; @@ -108,10 +108,10 @@ public class TmdbAccountTest extends AbstractTests { @Test public void testGetFavoriteMovies() throws MovieDbException { LOG.info("getFavoriteMovies"); - List results = instance.getFavoriteMovies(getSessionId(), getAccountId()); + List results = instance.getFavoriteMovies(getSessionId(), getAccountId()); assertNotNull("No list found", results); assertFalse("No entries found", results.isEmpty()); - for (MovieFavorite r : results) { + for (MovieBasic r : results) { LOG.info(" {}", r.toString()); } } @@ -124,10 +124,10 @@ public class TmdbAccountTest extends AbstractTests { @Test public void testGetFavoriteTv() throws MovieDbException { LOG.info("getFavoriteTv"); - List results = instance.getFavoriteTv(getSessionId(), getAccountId()); + List results = instance.getFavoriteTv(getSessionId(), getAccountId()); assertNotNull("No list found", results); assertFalse("No entries found", results.isEmpty()); - for (TVFavorite r : results) { + for (TVBasic r : results) { LOG.info(" {}", r.toString()); } } @@ -170,7 +170,7 @@ public class TmdbAccountTest extends AbstractTests { @Test public void testGetRatedMovies() throws MovieDbException { LOG.info("getRatedMovies"); - List results = instance.getRatedMovies(getSessionId(), getAccountId(), null, null, null); + List results = instance.getRatedMovies(getSessionId(), getAccountId(), null, null, null); assertNotNull("No rated list found", results); assertFalse("No entries found", results.isEmpty()); } @@ -183,10 +183,10 @@ public class TmdbAccountTest extends AbstractTests { @Test public void testGetRatedTV() throws MovieDbException { LOG.info("getRatedTV"); - List results = instance.getRatedTV(getSessionId(), getAccountId(), null, null, null); + List results = instance.getRatedTV(getSessionId(), getAccountId(), null, null, null); assertNotNull("No rated list found", results); assertFalse("No entries found", results.isEmpty()); - for (TVFavorite r : results) { + for (TVBasic r : results) { LOG.info(" {}", r.toString()); } } @@ -199,10 +199,10 @@ public class TmdbAccountTest extends AbstractTests { @Test public void testGetWatchListMovie() throws MovieDbException { LOG.info("getWatchListMovie"); - List results = instance.getWatchListMovie(getSessionId(), getAccountId(), null, null, null); + List results = instance.getWatchListMovie(getSessionId(), getAccountId(), null, null, null); assertNotNull("No rated list found", results); assertFalse("No entries found", results.isEmpty()); - for (MovieFavorite r : results) { + for (MovieBasic r : results) { LOG.info(" {}", r.toString()); } } @@ -215,10 +215,10 @@ public class TmdbAccountTest extends AbstractTests { @Test public void testGetWatchListTV() throws MovieDbException { LOG.info("getWatchListTV"); - List results = instance.getWatchListTV(getSessionId(), getAccountId(), null, null, null); + List results = instance.getWatchListTV(getSessionId(), getAccountId(), null, null, null); assertNotNull("No rated list found", results); assertFalse("No entries found", results.isEmpty()); - for (TVFavorite r : results) { + for (TVBasic r : results) { LOG.info(" {}", r.toString()); } } diff --git a/src/test/java/com/omertron/themoviedbapi/methods/TmdbCompaniesTest.java b/src/test/java/com/omertron/themoviedbapi/methods/TmdbCompaniesTest.java index 0ac9a4246..eef25701d 100644 --- a/src/test/java/com/omertron/themoviedbapi/methods/TmdbCompaniesTest.java +++ b/src/test/java/com/omertron/themoviedbapi/methods/TmdbCompaniesTest.java @@ -22,7 +22,7 @@ package com.omertron.themoviedbapi.methods; import com.omertron.themoviedbapi.AbstractTests; import com.omertron.themoviedbapi.MovieDbException; import com.omertron.themoviedbapi.model2.company.Company; -import com.omertron.themoviedbapi.model2.movie.MovieFavorite; +import com.omertron.themoviedbapi.model2.movie.MovieBasic; import java.util.List; import org.junit.After; import org.junit.AfterClass; @@ -84,7 +84,7 @@ public class TmdbCompaniesTest extends AbstractTests { @Test public void testGetCompanyMovies() throws MovieDbException { LOG.info("getCompanyMovies"); - List result = instance.getCompanyMovies(ID_COMPANY, LANGUAGE_DEFAULT, 0); + List result = instance.getCompanyMovies(ID_COMPANY, LANGUAGE_DEFAULT, 0); assertFalse("No company movies found", result.isEmpty()); } } diff --git a/src/test/java/com/omertron/themoviedbapi/methods/TmdbMoviesTest.java b/src/test/java/com/omertron/themoviedbapi/methods/TmdbMoviesTest.java index f57e707d1..828efd858 100644 --- a/src/test/java/com/omertron/themoviedbapi/methods/TmdbMoviesTest.java +++ b/src/test/java/com/omertron/themoviedbapi/methods/TmdbMoviesTest.java @@ -29,7 +29,7 @@ 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.model2.movie.MovieFavorite; +import com.omertron.themoviedbapi.model2.movie.MovieBasic; import com.omertron.themoviedbapi.results.TmdbResultsList; import java.util.List; import java.util.Random; @@ -313,12 +313,12 @@ public class TmdbMoviesTest extends AbstractTests { // get all rated movies TmdbAccount account = new TmdbAccount(getApiKey(), getHttpTools()); - List ratedMovies = account.getRatedMovies(getSessionId(), getAccountId(), null, null, null); + List ratedMovies = account.getRatedMovies(getSessionId(), getAccountId(), null, null, null); assertTrue(ratedMovies.size() > 0); // make sure that we find the movie and it is rated correctly boolean foundMovie = false; - for (MovieFavorite movie : ratedMovies) { + for (MovieBasic movie : ratedMovies) { if (movie.getId() == movieID) { assertEquals("Incorrect rating", movie.getRating(), (float) rating, 0); foundMovie = true;