Renamed "WrapperResultList" to "WrapperMovie" in line with other wrapper classes.
This commit is contained in:
@@ -220,8 +220,8 @@ public class TheMovieDb {
|
||||
URL url = tmdbSearchMovie.getQueryUrl(movieName, language, 1);
|
||||
String webPage = WebBrowser.request(url);
|
||||
try {
|
||||
WrapperResultList wrapper = mapper.readValue(webPage, WrapperResultList.class);
|
||||
return wrapper.getResults();
|
||||
WrapperMovie wrapper = mapper.readValue(webPage, WrapperMovie.class);
|
||||
return wrapper.getMovies();
|
||||
} catch (IOException ex) {
|
||||
LOGGER.warn("Failed to find movie: " + ex.getMessage());
|
||||
throw new MovieDbException(MovieDbExceptionType.MAPPING_FAILED, webPage, ex);
|
||||
@@ -673,8 +673,8 @@ public class TheMovieDb {
|
||||
String webPage = WebBrowser.request(url);
|
||||
|
||||
try {
|
||||
WrapperResultList wrapper = mapper.readValue(webPage, WrapperResultList.class);
|
||||
return wrapper.getResults();
|
||||
WrapperMovie wrapper = mapper.readValue(webPage, WrapperMovie.class);
|
||||
return wrapper.getMovies();
|
||||
} catch (IOException ex) {
|
||||
LOGGER.warn("Failed to get now playing movies: " + ex.getMessage());
|
||||
throw new MovieDbException(MovieDbExceptionType.MAPPING_FAILED, webPage, ex);
|
||||
@@ -698,8 +698,8 @@ public class TheMovieDb {
|
||||
String webPage = WebBrowser.request(url);
|
||||
|
||||
try {
|
||||
WrapperResultList wrapper = mapper.readValue(webPage, WrapperResultList.class);
|
||||
return wrapper.getResults();
|
||||
WrapperMovie wrapper = mapper.readValue(webPage, WrapperMovie.class);
|
||||
return wrapper.getMovies();
|
||||
} catch (IOException ex) {
|
||||
LOGGER.warn("Failed to get popular movie list: " + ex.getMessage());
|
||||
throw new MovieDbException(MovieDbExceptionType.MAPPING_FAILED, webPage, ex);
|
||||
@@ -723,8 +723,8 @@ public class TheMovieDb {
|
||||
String webPage = WebBrowser.request(url);
|
||||
|
||||
try {
|
||||
WrapperResultList wrapper = mapper.readValue(webPage, WrapperResultList.class);
|
||||
return wrapper.getResults();
|
||||
WrapperMovie wrapper = mapper.readValue(webPage, WrapperMovie.class);
|
||||
return wrapper.getMovies();
|
||||
} catch (IOException ex) {
|
||||
LOGGER.warn("Failed to get top rated movies: " + ex.getMessage());
|
||||
throw new MovieDbException(MovieDbExceptionType.MAPPING_FAILED, webPage, ex);
|
||||
@@ -825,8 +825,8 @@ public class TheMovieDb {
|
||||
String webPage = WebBrowser.request(url);
|
||||
|
||||
try {
|
||||
WrapperResultList wrapper = mapper.readValue(webPage, WrapperResultList.class);
|
||||
return wrapper.getResults();
|
||||
WrapperMovie wrapper = mapper.readValue(webPage, WrapperMovie.class);
|
||||
return wrapper.getMovies();
|
||||
} catch (IOException ex) {
|
||||
LOGGER.warn("Failed to get similar movies: " + ex.getMessage());
|
||||
throw new MovieDbException(MovieDbExceptionType.MAPPING_FAILED, webPage, ex);
|
||||
@@ -871,8 +871,8 @@ public class TheMovieDb {
|
||||
String webPage = WebBrowser.request(url);
|
||||
|
||||
try {
|
||||
WrapperResultList wrapper = mapper.readValue(webPage, WrapperResultList.class);
|
||||
return wrapper.getResults();
|
||||
WrapperMovie wrapper = mapper.readValue(webPage, WrapperMovie.class);
|
||||
return wrapper.getMovies();
|
||||
} catch (IOException ex) {
|
||||
LOGGER.warn("Failed to get genre movie list: " + ex.getMessage());
|
||||
throw new MovieDbException(MovieDbExceptionType.MAPPING_FAILED, webPage, ex);
|
||||
|
||||
+8
-8
@@ -22,19 +22,19 @@ import org.codehaus.jackson.annotate.JsonProperty;
|
||||
*
|
||||
* @author stuart.boston
|
||||
*/
|
||||
public class WrapperResultList {
|
||||
public class WrapperMovie {
|
||||
/*
|
||||
* Logger
|
||||
*/
|
||||
|
||||
private static final Logger LOGGER = Logger.getLogger(WrapperResultList.class);
|
||||
private static final Logger LOGGER = Logger.getLogger(WrapperMovie.class);
|
||||
/*
|
||||
* Properties
|
||||
*/
|
||||
@JsonProperty("page")
|
||||
private int page;
|
||||
@JsonProperty("results")
|
||||
private List<MovieDb> results;
|
||||
private List<MovieDb> movies;
|
||||
@JsonProperty("total_pages")
|
||||
private int totalPages;
|
||||
@JsonProperty("total_results")
|
||||
@@ -47,8 +47,8 @@ public class WrapperResultList {
|
||||
return page;
|
||||
}
|
||||
|
||||
public List<MovieDb> getResults() {
|
||||
return results;
|
||||
public List<MovieDb> getMovies() {
|
||||
return movies;
|
||||
}
|
||||
|
||||
public int getTotalPages() {
|
||||
@@ -69,8 +69,8 @@ public class WrapperResultList {
|
||||
this.page = page;
|
||||
}
|
||||
|
||||
public void setResults(List<MovieDb> results) {
|
||||
this.results = results;
|
||||
public void setMovies(List<MovieDb> results) {
|
||||
this.movies = results;
|
||||
}
|
||||
|
||||
public void setTotalPages(int totalPages) {
|
||||
@@ -104,7 +104,7 @@ public class WrapperResultList {
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder("[ResultList=[");
|
||||
sb.append("[page=").append(page);
|
||||
sb.append("],[pageResults=").append(results.size());
|
||||
sb.append("],[pageResults=").append(movies.size());
|
||||
sb.append("],[totalPages=").append(totalPages);
|
||||
sb.append("],[totalResults=").append(totalResults);
|
||||
sb.append("],[id=").append(id);
|
||||
@@ -367,7 +367,7 @@ public class TheMovieDbTest {
|
||||
* Test of getCompanyInfo method, of class TheMovieDb.
|
||||
*/
|
||||
@Test
|
||||
public void testGetCompanyInfo() throws Exception {
|
||||
public void testGetCompanyInfo() throws MovieDbException {
|
||||
LOGGER.info("getCompanyInfo");
|
||||
Company company = tmdb.getCompanyInfo(ID_COMPANY_LUCASFILM);
|
||||
assertTrue("No company information found", company.getCompanyId() > 0);
|
||||
@@ -377,7 +377,7 @@ public class TheMovieDbTest {
|
||||
* Test of getCompanyMovies method, of class TheMovieDb.
|
||||
*/
|
||||
@Test
|
||||
public void testGetCompanyMovies() throws Exception {
|
||||
public void testGetCompanyMovies() throws MovieDbException {
|
||||
LOGGER.info("getCompanyMovies");
|
||||
List<MovieDb> results = tmdb.getCompanyMovies(ID_COMPANY_LUCASFILM, "", true);
|
||||
assertTrue("No company movies found", !results.isEmpty());
|
||||
@@ -395,7 +395,7 @@ public class TheMovieDbTest {
|
||||
* Test of searchCompanies method, of class TheMovieDb.
|
||||
*/
|
||||
@Test
|
||||
public void testSearchCompanies() throws Exception {
|
||||
public void testSearchCompanies() throws MovieDbException {
|
||||
LOGGER.info("searchCompanies");
|
||||
List<Company> results = tmdb.searchCompanies(COMPANY_NAME, "", true);
|
||||
assertTrue("No company information found", !results.isEmpty());
|
||||
@@ -405,7 +405,7 @@ public class TheMovieDbTest {
|
||||
* Test of getSimilarMovies method, of class TheMovieDb.
|
||||
*/
|
||||
@Test
|
||||
public void testGetSimilarMovies() throws Exception {
|
||||
public void testGetSimilarMovies() throws MovieDbException {
|
||||
LOGGER.info("getSimilarMovies");
|
||||
List<MovieDb> results = tmdb.getSimilarMovies(ID_MOVIE_BLADE_RUNNER, "", true);
|
||||
assertTrue("No similar movies found", !results.isEmpty());
|
||||
|
||||
Reference in New Issue
Block a user