Rename ResultsMap

master
Stuart Boston 11 years ago
parent 5c56e20f73
commit 9245984ca2

@ -81,7 +81,7 @@ import com.omertron.themoviedbapi.model.review.Review;
import com.omertron.themoviedbapi.model.tv.TVBasic;
import com.omertron.themoviedbapi.model.tv.TVInfo;
import com.omertron.themoviedbapi.results.ResultList;
import com.omertron.themoviedbapi.results.TmdbResultsMap;
import com.omertron.themoviedbapi.results.ResultsMap;
import com.omertron.themoviedbapi.tools.HttpTools;
import com.omertron.themoviedbapi.tools.MethodBase;
import com.omertron.themoviedbapi.wrapper.WrapperChanges;
@ -421,7 +421,7 @@ public class TheMovieDbApi {
* @return
* @throws MovieDbException
*/
public TmdbResultsMap<String, List<Certification>> getMoviesCertification() throws MovieDbException {
public ResultsMap<String, List<Certification>> getMoviesCertification() throws MovieDbException {
return tmdbCertifications.getMoviesCertification();
}
@ -431,7 +431,7 @@ public class TheMovieDbApi {
* @return
* @throws MovieDbException
*/
public TmdbResultsMap<String, List<Certification>> getTvCertification() throws MovieDbException {
public ResultsMap<String, List<Certification>> getTvCertification() throws MovieDbException {
return tmdbCertifications.getTvCertification();
}
//</editor-fold>

@ -20,7 +20,7 @@
package com.omertron.themoviedbapi.methods;
import com.omertron.themoviedbapi.MovieDbException;
import com.omertron.themoviedbapi.results.TmdbResultsMap;
import com.omertron.themoviedbapi.results.ResultsMap;
import com.omertron.themoviedbapi.tools.HttpTools;
import java.util.List;
import com.fasterxml.jackson.core.type.TypeReference;
@ -57,7 +57,7 @@ public class TmdbCertifications extends AbstractMethod {
* @return
* @throws MovieDbException
*/
public TmdbResultsMap<String, List<Certification>> getMoviesCertification() throws MovieDbException {
public ResultsMap<String, List<Certification>> getMoviesCertification() throws MovieDbException {
URL url = new ApiUrl(apiKey, MethodBase.CERTIFICATION).subMethod(MethodSub.MOVIE_LIST).buildUrl();
String webpage = httpTools.getRequest(url);
@ -65,7 +65,7 @@ public class TmdbCertifications extends AbstractMethod {
JsonNode node = MAPPER.readTree(webpage);
Map<String, List<Certification>> results = MAPPER.readValue(node.elements().next().traverse(), new TypeReference<Map<String, List<Certification>>>() {
});
return new TmdbResultsMap<String, List<Certification>>(results);
return new ResultsMap<String, List<Certification>>(results);
} catch (IOException ex) {
throw new MovieDbException(ApiExceptionType.MAPPING_FAILED, "Failed to get movie certifications", url, ex);
}
@ -77,7 +77,7 @@ public class TmdbCertifications extends AbstractMethod {
* @return
* @throws MovieDbException
*/
public TmdbResultsMap<String, List<Certification>> getTvCertification() throws MovieDbException {
public ResultsMap<String, List<Certification>> getTvCertification() throws MovieDbException {
URL url = new ApiUrl(apiKey, MethodBase.CERTIFICATION).subMethod(MethodSub.TV_LIST).buildUrl();
String webpage = httpTools.getRequest(url);
@ -85,7 +85,7 @@ public class TmdbCertifications extends AbstractMethod {
JsonNode node = MAPPER.readTree(webpage);
Map<String, List<Certification>> results = MAPPER.readValue(node.elements().next().traverse(), new TypeReference<Map<String, List<Certification>>>() {
});
return new TmdbResultsMap<String, List<Certification>>(results);
return new ResultsMap<String, List<Certification>>(results);
} catch (IOException ex) {
throw new MovieDbException(ApiExceptionType.MAPPING_FAILED, "Failed to get TV certifications", url, ex);
}

@ -29,11 +29,11 @@ import java.util.Map;
* @param <K>
* @param <V>
*/
public final class TmdbResultsMap<K, V> extends AbstractResults {
public final class ResultsMap<K, V> extends AbstractResults {
private Map<K, V> results;
public TmdbResultsMap(Map<K, V> resultsMap) {
public ResultsMap(Map<K, V> resultsMap) {
results = new HashMap<K, V>(resultsMap);
}

@ -22,7 +22,7 @@ package com.omertron.themoviedbapi.methods;
import com.omertron.themoviedbapi.AbstractTests;
import com.omertron.themoviedbapi.MovieDbException;
import com.omertron.themoviedbapi.model.Certification;
import com.omertron.themoviedbapi.results.TmdbResultsMap;
import com.omertron.themoviedbapi.results.ResultsMap;
import java.util.List;
import java.util.Map;
import org.junit.AfterClass;
@ -60,7 +60,7 @@ public class TmdbCertificationsTest extends AbstractTests {
@Test
public void testGetMovieCertifications() throws MovieDbException {
LOG.info("getMovieCertifications");
TmdbResultsMap<String, List<Certification>> result = instance.getMoviesCertification();
ResultsMap<String, List<Certification>> result = instance.getMoviesCertification();
assertFalse("No movie certifications.", result.getResults().isEmpty());
for (Map.Entry<String, List<Certification>> entry : result.getResults().entrySet()) {
LOG.info("{} = {} entries", entry.getKey(), entry.getValue().size());
@ -76,7 +76,7 @@ public class TmdbCertificationsTest extends AbstractTests {
@Test
public void testGetTvCertifications() throws MovieDbException {
LOG.info("getTvCertifications");
TmdbResultsMap<String, List<Certification>> result = instance.getTvCertification();
ResultsMap<String, List<Certification>> result = instance.getTvCertification();
assertFalse("No tv certifications.", result.getResults().isEmpty());
for (Map.Entry<String, List<Certification>> entry : result.getResults().entrySet()) {
LOG.info("{} = {} entries", entry.getKey(), entry.getValue().size());

@ -27,7 +27,6 @@ import com.omertron.themoviedbapi.tools.MethodBase;
import org.junit.AfterClass;
import static org.junit.Assert.assertFalse;
import org.junit.BeforeClass;
import org.junit.Ignore;
import org.junit.Test;
/**
@ -60,7 +59,7 @@ public class TmdbChangesTest extends AbstractTests {
public void testGetMovieChangesList() throws MovieDbException {
LOG.info("getMovieChangesList");
ResultList<ChangeListItem> result = instance.getChangeList(MethodBase.MOVIE, null, null, null);
assertFalse("No movie changes.", result.isEmpty());
assertFalse("No Movie changes.", result.isEmpty());
}
/**
@ -68,7 +67,7 @@ public class TmdbChangesTest extends AbstractTests {
*
* @throws MovieDbException
*/
@Ignore("Not ready yet")
@Test
public void testGetPersonChangesList() throws MovieDbException {
LOG.info("getPersonChangesList");
ResultList<ChangeListItem> result = instance.getChangeList(MethodBase.PERSON, null, null, null);
@ -80,10 +79,10 @@ public class TmdbChangesTest extends AbstractTests {
*
* @throws MovieDbException
*/
@Ignore("Not ready yet")
@Test
public void testGetTVChangesList() throws MovieDbException {
LOG.info("getPersonChangesList");
ResultList<ChangeListItem> result = instance.getChangeList(MethodBase.PERSON, null, null, null);
LOG.info("getTVChangesList");
ResultList<ChangeListItem> result = instance.getChangeList(MethodBase.TV, null, null, null);
assertFalse("No TV changes.", result.isEmpty());
}
}

Loading…
Cancel
Save