From 0143f31bbcd8e3333f79ca2e14b4ff0022ecbc9f Mon Sep 17 00:00:00 2001 From: Stuart Boston Date: Mon, 2 Mar 2015 15:46:07 +0000 Subject: [PATCH] Person --- .../omertron/themoviedbapi/TheMovieDbApi.java | 8 +- .../themoviedbapi/methods/TmdbChanges.java | 25 +++--- .../themoviedbapi/methods/TmdbPeople.java | 39 +++++--- .../model2/change/ChangeKeyItem.java | 51 +++++++++++ .../model2/change/ChangeListItem.java | 49 ++++++++++ .../model2/change/ChangedItem.java | 89 +++++++++++++++++++ .../themoviedbapi/wrapper/WrapperChanges.java | 19 +--- .../methods/TmdbChangesTest.java | 16 ++-- .../themoviedbapi/methods/TmdbPeopleTest.java | 56 +++++++----- 9 files changed, 277 insertions(+), 75 deletions(-) create mode 100644 src/main/java/com/omertron/themoviedbapi/model2/change/ChangeKeyItem.java create mode 100644 src/main/java/com/omertron/themoviedbapi/model2/change/ChangeListItem.java create mode 100644 src/main/java/com/omertron/themoviedbapi/model2/change/ChangedItem.java diff --git a/src/main/java/com/omertron/themoviedbapi/TheMovieDbApi.java b/src/main/java/com/omertron/themoviedbapi/TheMovieDbApi.java index a774036e2..5b0d9a9d4 100644 --- a/src/main/java/com/omertron/themoviedbapi/TheMovieDbApi.java +++ b/src/main/java/com/omertron/themoviedbapi/TheMovieDbApi.java @@ -50,7 +50,6 @@ 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.change.ChangedMedia; import com.omertron.themoviedbapi.model.keyword.Keyword; import com.omertron.themoviedbapi.model.keyword.KeywordMovie; import com.omertron.themoviedbapi.model.person.Person; @@ -60,6 +59,7 @@ import com.omertron.themoviedbapi.model2.account.Account; import com.omertron.themoviedbapi.model2.artwork.Artwork; import com.omertron.themoviedbapi.model2.authentication.TokenAuthorisation; import com.omertron.themoviedbapi.model2.authentication.TokenSession; +import com.omertron.themoviedbapi.model2.change.ChangeListItem; import com.omertron.themoviedbapi.model2.collection.Collection; import com.omertron.themoviedbapi.model2.collection.CollectionInfo; import com.omertron.themoviedbapi.model2.company.Company; @@ -529,7 +529,7 @@ public class TheMovieDbApi { * @return List of changed movie * @throws MovieDbException */ - public TmdbResultsList getMovieChangeList(int page, String startDate, String endDate) throws MovieDbException { + public List getMovieChangeList(int page, String startDate, String endDate) throws MovieDbException { return tmdbChanges.getChangeList(MethodBase.MOVIE, page, startDate, endDate); } @@ -544,7 +544,7 @@ public class TheMovieDbApi { * @return List of changed movie * @throws MovieDbException */ - public TmdbResultsList getTvChangeList(int page, String startDate, String endDate) throws MovieDbException { + public List getTvChangeList(int page, String startDate, String endDate) throws MovieDbException { return tmdbChanges.getChangeList(MethodBase.TV, page, startDate, endDate); } @@ -559,7 +559,7 @@ public class TheMovieDbApi { * @return List of changed movie * @throws MovieDbException */ - public TmdbResultsList getPersonChangeList(int page, String startDate, String endDate) throws MovieDbException { + public List getPersonChangeList(int page, String startDate, String endDate) throws MovieDbException { return tmdbChanges.getChangeList(MethodBase.PERSON, page, startDate, endDate); } // diff --git a/src/main/java/com/omertron/themoviedbapi/methods/TmdbChanges.java b/src/main/java/com/omertron/themoviedbapi/methods/TmdbChanges.java index 66067077a..7869aface 100644 --- a/src/main/java/com/omertron/themoviedbapi/methods/TmdbChanges.java +++ b/src/main/java/com/omertron/themoviedbapi/methods/TmdbChanges.java @@ -19,19 +19,18 @@ */ package com.omertron.themoviedbapi.methods; +import com.fasterxml.jackson.core.type.TypeReference; import com.omertron.themoviedbapi.MovieDbException; -import com.omertron.themoviedbapi.model.change.ChangedMedia; -import com.omertron.themoviedbapi.results.TmdbResultsList; +import com.omertron.themoviedbapi.model2.change.ChangeListItem; import com.omertron.themoviedbapi.tools.ApiUrl; import com.omertron.themoviedbapi.tools.HttpTools; import com.omertron.themoviedbapi.tools.MethodBase; import com.omertron.themoviedbapi.tools.MethodSub; import com.omertron.themoviedbapi.tools.Param; import com.omertron.themoviedbapi.tools.TmdbParameters; -import com.omertron.themoviedbapi.wrapper.WrapperMediaChanges; -import java.io.IOException; +import com.omertron.themoviedbapi.wrapper.WrapperGenericList; import java.net.URL; -import org.yamj.api.common.exception.ApiExceptionType; +import java.util.List; /** * Class to hold the Change Methods @@ -53,7 +52,8 @@ public class TmdbChanges extends AbstractMethod { /** * Get a list of Media IDs that have been edited. * - * You can then use the movie/TV/person changes API to get the actual data that has been changed. + * You can then use the movie/TV/person changes API to get the actual data + * that has been changed. * * @param method The method base to get * @param page @@ -62,7 +62,7 @@ public class TmdbChanges extends AbstractMethod { * @return List of changed movie * @throws MovieDbException */ - public TmdbResultsList getChangeList(MethodBase method, Integer page, String startDate, String endDate) throws MovieDbException { + public List getChangeList(MethodBase method, Integer page, String startDate, String endDate) throws MovieDbException { TmdbParameters params = new TmdbParameters(); params.add(Param.PAGE, page); params.add(Param.START_DATE, startDate); @@ -71,15 +71,10 @@ public class TmdbChanges extends AbstractMethod { URL url = new ApiUrl(apiKey, method).setSubMethod(MethodSub.CHANGES).buildUrl(params); String webpage = httpTools.getRequest(url); - try { - WrapperMediaChanges wrapper = MAPPER.readValue(webpage, WrapperMediaChanges.class); + TypeReference tr = new TypeReference>() { + }; - TmdbResultsList results = new TmdbResultsList(wrapper.getResults()); - results.copyWrapper(wrapper); - return results; - } catch (IOException ex) { - throw new MovieDbException(ApiExceptionType.MAPPING_FAILED, "Failed to get changes", url, ex); - } + return processWrapperList(tr, url, "changes"); } } diff --git a/src/main/java/com/omertron/themoviedbapi/methods/TmdbPeople.java b/src/main/java/com/omertron/themoviedbapi/methods/TmdbPeople.java index 1a2639493..b23ea75fa 100644 --- a/src/main/java/com/omertron/themoviedbapi/methods/TmdbPeople.java +++ b/src/main/java/com/omertron/themoviedbapi/methods/TmdbPeople.java @@ -21,8 +21,8 @@ package com.omertron.themoviedbapi.methods; import com.fasterxml.jackson.core.type.TypeReference; import com.omertron.themoviedbapi.MovieDbException; -import com.omertron.themoviedbapi.model2.artwork.Artwork; import com.omertron.themoviedbapi.enumeration.ArtworkType; +import com.omertron.themoviedbapi.model2.artwork.Artwork; import com.omertron.themoviedbapi.model2.artwork.ArtworkMedia; import com.omertron.themoviedbapi.model2.person.CreditMovieBasic; import com.omertron.themoviedbapi.model2.person.CreditTVBasic; @@ -37,6 +37,7 @@ import com.omertron.themoviedbapi.tools.MethodBase; import com.omertron.themoviedbapi.tools.MethodSub; import com.omertron.themoviedbapi.tools.Param; import com.omertron.themoviedbapi.tools.TmdbParameters; +import com.omertron.themoviedbapi.wrapper.WrapperChanges; import com.omertron.themoviedbapi.wrapper.WrapperGenericList; import com.omertron.themoviedbapi.wrapper.WrapperImages; import java.io.IOException; @@ -112,9 +113,11 @@ public class TmdbPeople extends AbstractMethod { /** * Get the TV credits for a specific person id. * - * To get the expanded details for each record, call the /credit method with the provided credit_id. + * To get the expanded details for each record, call the /credit method with + * the provided credit_id. * - * This will provide details about which episode and/or season the credit is for. + * This will provide details about which episode and/or season the credit is + * for. * * @param personId * @param language @@ -142,9 +145,11 @@ public class TmdbPeople extends AbstractMethod { /** * Get the combined (movie and TV) credits for a specific person id. * - * To get the expanded details for each TV record, call the /credit method with the provided credit_id. + * To get the expanded details for each TV record, call the /credit method + * with the provided credit_id. * - * This will provide details about which episode and/or season the credit is for. + * This will provide details about which episode and/or season the credit is + * for. * * @param personId * @param language @@ -217,7 +222,8 @@ public class TmdbPeople extends AbstractMethod { /** * Get the images that have been tagged with a specific person id. * - * We return all of the image results with a media object mapped for each image. + * We return all of the image results with a media object mapped for each + * image. * * @param personId * @param page @@ -254,18 +260,31 @@ public class TmdbPeople extends AbstractMethod { * * By default, only the last 24 hours of changes are returned. * - * The maximum number of days that can be returned in a single request is 14. + * The maximum number of days that can be returned in a single request is + * 14. * * The language is present on fields that are translatable. * - * @param persondId + * @param personId * @param startDate * @param endDate * @return * @throws com.omertron.themoviedbapi.MovieDbException */ - public TmdbResultsList getPersonChanges(int persondId, String startDate, String endDate) throws MovieDbException { - throw new MovieDbException(ApiExceptionType.UNKNOWN_CAUSE, "Not done"); + public WrapperChanges getPersonChanges(int personId, String startDate, String endDate) throws MovieDbException { + TmdbParameters parameters = new TmdbParameters(); + parameters.add(Param.ID, personId); + parameters.add(Param.START_DATE, startDate); + parameters.add(Param.END_DATE, endDate); + + URL url = new ApiUrl(apiKey, MethodBase.PERSON).setSubMethod(MethodSub.CHANGES).buildUrl(parameters); + String webpage = httpTools.getRequest(url); + + try { + return MAPPER.readValue(webpage, WrapperChanges.class); + } catch (IOException ex) { + throw new MovieDbException(ApiExceptionType.MAPPING_FAILED, "Failed to get person changes", url, ex); + } } /** diff --git a/src/main/java/com/omertron/themoviedbapi/model2/change/ChangeKeyItem.java b/src/main/java/com/omertron/themoviedbapi/model2/change/ChangeKeyItem.java new file mode 100644 index 000000000..62e32f6e4 --- /dev/null +++ b/src/main/java/com/omertron/themoviedbapi/model2/change/ChangeKeyItem.java @@ -0,0 +1,51 @@ +/* + * Copyright (c) 2004-2015 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.model2.change; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.omertron.themoviedbapi.model2.AbstractJsonMapping; +import java.util.ArrayList; +import java.util.List; + +public class ChangeKeyItem extends AbstractJsonMapping { + + private static final long serialVersionUID = 1L; + @JsonProperty("key") + private String key; + @JsonProperty("items") + private List changedItems = new ArrayList(); + + public String getKey() { + return key; + } + + public void setKey(String key) { + this.key = key; + } + + public List getChangedItems() { + return changedItems; + } + + public void setChangedItems(List changes) { + this.changedItems = changes; + } + +} diff --git a/src/main/java/com/omertron/themoviedbapi/model2/change/ChangeListItem.java b/src/main/java/com/omertron/themoviedbapi/model2/change/ChangeListItem.java new file mode 100644 index 000000000..5f7a8d04c --- /dev/null +++ b/src/main/java/com/omertron/themoviedbapi/model2/change/ChangeListItem.java @@ -0,0 +1,49 @@ +/* + * Copyright (c) 2004-2015 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.model2.change; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.omertron.themoviedbapi.model2.AbstractJsonMapping; + +public class ChangeListItem extends AbstractJsonMapping { + + private static final long serialVersionUID = 1L; + + @JsonProperty("id") + private int id; + @JsonProperty("adult") + private boolean adult; + + public int getId() { + return id; + } + + public boolean isAdult() { + return adult; + } + + public void setId(int id) { + this.id = id; + } + + public void setAdult(boolean adult) { + this.adult = adult; + } +} diff --git a/src/main/java/com/omertron/themoviedbapi/model2/change/ChangedItem.java b/src/main/java/com/omertron/themoviedbapi/model2/change/ChangedItem.java new file mode 100644 index 000000000..7c4c58e37 --- /dev/null +++ b/src/main/java/com/omertron/themoviedbapi/model2/change/ChangedItem.java @@ -0,0 +1,89 @@ +/* + * Copyright (c) 2004-2015 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.model2.change; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.omertron.themoviedbapi.model2.AbstractJsonMapping; + +public class ChangedItem extends AbstractJsonMapping { + + private static final long serialVersionUID = 1L; + @JsonProperty("id") + private String id; + @JsonProperty("action") + private String action; + @JsonProperty("time") + private String time; + @JsonProperty("iso_639_1") + private String language; + @JsonProperty("value") + private Object value; + @JsonProperty("original_value") + private Object originalValue; + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getAction() { + return action; + } + + public void setAction(String action) { + this.action = action; + } + + public String getTime() { + return time; + } + + public void setTime(String time) { + this.time = time; + } + + public String getLanguage() { + return language; + } + + public void setLanguage(String language) { + this.language = language; + } + + public Object getValue() { + return value; + } + + public void setValue(Object value) { + this.value = value; + } + + public Object getOriginalValue() { + return originalValue; + } + + public void setOriginalValue(Object originalValue) { + this.originalValue = originalValue; + } + +} diff --git a/src/main/java/com/omertron/themoviedbapi/wrapper/WrapperChanges.java b/src/main/java/com/omertron/themoviedbapi/wrapper/WrapperChanges.java index 073a8dac0..e45751a55 100644 --- a/src/main/java/com/omertron/themoviedbapi/wrapper/WrapperChanges.java +++ b/src/main/java/com/omertron/themoviedbapi/wrapper/WrapperChanges.java @@ -19,22 +19,17 @@ */ package com.omertron.themoviedbapi.wrapper; -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; import com.fasterxml.jackson.annotation.JsonProperty; -import com.omertron.themoviedbapi.model.change.ChangeKeyItem; +import com.omertron.themoviedbapi.model2.change.ChangeKeyItem; import java.util.ArrayList; -import java.util.HashMap; import java.util.List; -import java.util.Map; import org.apache.commons.lang3.builder.ToStringBuilder; import org.apache.commons.lang3.builder.ToStringStyle; -public class WrapperChanges { +public class WrapperChanges extends AbstractWrapper{ @JsonProperty("changes") private List changedItems = new ArrayList(); - private final Map newItems = new HashMap(); public List getChangedItems() { return changedItems; @@ -44,16 +39,6 @@ public class WrapperChanges { this.changedItems = changes; } - @JsonAnyGetter - public Map getNewItems() { - return this.newItems; - } - - @JsonAnySetter - public void setNewItems(String name, Object value) { - this.newItems.put(name, value); - } - @Override public String toString() { return ToStringBuilder.reflectionToString(this, ToStringStyle.DEFAULT_STYLE); diff --git a/src/test/java/com/omertron/themoviedbapi/methods/TmdbChangesTest.java b/src/test/java/com/omertron/themoviedbapi/methods/TmdbChangesTest.java index ca539e21e..51443a2b4 100644 --- a/src/test/java/com/omertron/themoviedbapi/methods/TmdbChangesTest.java +++ b/src/test/java/com/omertron/themoviedbapi/methods/TmdbChangesTest.java @@ -21,9 +21,9 @@ package com.omertron.themoviedbapi.methods; import com.omertron.themoviedbapi.AbstractTests; import com.omertron.themoviedbapi.MovieDbException; -import com.omertron.themoviedbapi.model.change.ChangedMedia; -import com.omertron.themoviedbapi.results.TmdbResultsList; +import com.omertron.themoviedbapi.model2.change.ChangeListItem; import com.omertron.themoviedbapi.tools.MethodBase; +import java.util.List; import org.junit.AfterClass; import static org.junit.Assert.assertFalse; import org.junit.BeforeClass; @@ -60,8 +60,8 @@ public class TmdbChangesTest extends AbstractTests { @Test public void testGetMovieChangesList() throws MovieDbException { LOG.info("getMovieChangesList"); - TmdbResultsList result = instance.getChangeList(MethodBase.MOVIE, null, null, null); - assertFalse("No movie changes.", result.getResults().isEmpty()); + List result = instance.getChangeList(MethodBase.MOVIE, null, null, null); + assertFalse("No movie changes.", result.isEmpty()); } /** @@ -72,8 +72,8 @@ public class TmdbChangesTest extends AbstractTests { @Ignore("Not ready yet") public void testGetPersonChangesList() throws MovieDbException { LOG.info("getPersonChangesList"); - TmdbResultsList result = instance.getChangeList(MethodBase.PERSON, null, null, null); - assertFalse("No Person changes.", result.getResults().isEmpty()); + List result = instance.getChangeList(MethodBase.PERSON, null, null, null); + assertFalse("No Person changes.", result.isEmpty()); } /** @@ -84,7 +84,7 @@ public class TmdbChangesTest extends AbstractTests { @Ignore("Not ready yet") public void testGetTVChangesList() throws MovieDbException { LOG.info("getPersonChangesList"); - TmdbResultsList result = instance.getChangeList(MethodBase.PERSON, null, null, null); - assertFalse("No TV changes.", result.getResults().isEmpty()); + List result = instance.getChangeList(MethodBase.PERSON, null, null, null); + assertFalse("No TV changes.", result.isEmpty()); } } diff --git a/src/test/java/com/omertron/themoviedbapi/methods/TmdbPeopleTest.java b/src/test/java/com/omertron/themoviedbapi/methods/TmdbPeopleTest.java index 39fd86041..268623f4b 100644 --- a/src/test/java/com/omertron/themoviedbapi/methods/TmdbPeopleTest.java +++ b/src/test/java/com/omertron/themoviedbapi/methods/TmdbPeopleTest.java @@ -23,9 +23,10 @@ import com.omertron.themoviedbapi.AbstractTests; import com.omertron.themoviedbapi.MovieDbException; import com.omertron.themoviedbapi.TestID; import com.omertron.themoviedbapi.enumeration.ArtworkType; -import com.omertron.themoviedbapi.model2.MediaBasic; import com.omertron.themoviedbapi.model2.artwork.Artwork; import com.omertron.themoviedbapi.model2.artwork.ArtworkMedia; +import com.omertron.themoviedbapi.model2.change.ChangeKeyItem; +import com.omertron.themoviedbapi.model2.change.ChangeListItem; import com.omertron.themoviedbapi.model2.person.CreditMovieBasic; import com.omertron.themoviedbapi.model2.person.CreditTVBasic; import com.omertron.themoviedbapi.model2.person.ExternalID; @@ -33,15 +34,19 @@ import com.omertron.themoviedbapi.model2.person.Person; import com.omertron.themoviedbapi.model2.person.PersonCredits; import com.omertron.themoviedbapi.model2.person.PersonFind; import com.omertron.themoviedbapi.results.TmdbResultsList; +import com.omertron.themoviedbapi.tools.MethodBase; +import com.omertron.themoviedbapi.wrapper.WrapperChanges; +import java.text.SimpleDateFormat; import java.util.ArrayList; +import java.util.Date; import java.util.List; import org.apache.commons.lang3.StringUtils; -import org.apache.commons.lang3.builder.ToStringBuilder; -import org.apache.commons.lang3.builder.ToStringStyle; +import org.apache.commons.lang3.time.DateUtils; import org.junit.After; 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.Before; @@ -55,7 +60,6 @@ import org.junit.Test; public class TmdbPeopleTest extends AbstractTests { private static TmdbPeople instance; - private static final int ID_DICK_WOLF = 117443; private static final List testIDs = new ArrayList(); public TmdbPeopleTest() { @@ -210,8 +214,10 @@ public class TmdbPeopleTest extends AbstractTests { for (TestID test : testIDs) { TmdbResultsList result = instance.getPersonTaggedImages(test.getTmdb(), page, language); + assertFalse("No images", result.isEmpty()); for (ArtworkMedia am : result.getResults()) { - LOG.info("{}", ToStringBuilder.reflectionToString(am, ToStringStyle.DEFAULT_STYLE)); + assertTrue("No ID", StringUtils.isNotBlank(am.getId())); + assertTrue("No file path", StringUtils.isNotBlank(am.getFilePath())); } } } @@ -221,18 +227,30 @@ public class TmdbPeopleTest extends AbstractTests { * * @throws com.omertron.themoviedbapi.MovieDbException */ - //@Test + @Test public void testGetPersonChanges() throws MovieDbException { LOG.info("getPersonChanges"); - int persondId = 0; - String startDate = ""; + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); + String startDate = sdf.format(DateUtils.addDays(new Date(), -14)); String endDate = ""; + int maxCheck = 5; + + TmdbChanges chgs = new TmdbChanges(getApiKey(), getHttpTools()); + List changeList = chgs.getChangeList(MethodBase.PERSON, null, null, null); + LOG.info("Found {} person changes to check", changeList.size()); - TmdbResultsList expResult = null; - TmdbResultsList result = instance.getPersonChanges(persondId, startDate, endDate); - assertEquals(expResult, result); - // TODO review the generated test code and remove the default call to fail. - fail("The test case is a prototype."); + int count = 1; + WrapperChanges result; + for (ChangeListItem item : changeList) { + result = instance.getPersonChanges(item.getId(), startDate, endDate); + for (ChangeKeyItem ci : result.getChangedItems()) { + assertNotNull("Null changes",ci); + } + + if (count++ > maxCheck) { + break; + } + } } /** @@ -240,7 +258,7 @@ public class TmdbPeopleTest extends AbstractTests { * * @throws com.omertron.themoviedbapi.MovieDbException */ - @Test +// @Test public void testGetPersonPopular() throws MovieDbException { LOG.info("getPersonPopular"); Integer page = null; @@ -248,10 +266,8 @@ public class TmdbPeopleTest extends AbstractTests { assertFalse("No results", result.isEmpty()); assertTrue("No results", result.getResults().size() > 0); for (PersonFind p : result.getResults()) { + assertFalse("No known for entries", p.getKnownFor().isEmpty()); LOG.info("{} ({}) = {}", p.getName(), p.getId(), p.getKnownFor().size()); - for (MediaBasic k : p.getKnownFor()) { - LOG.info(" {}", k.toString()); - } } } @@ -264,11 +280,9 @@ public class TmdbPeopleTest extends AbstractTests { public void testGetPersonLatest() throws MovieDbException { LOG.info("getPersonLatest"); - Person expResult = null; Person result = instance.getPersonLatest(); - assertEquals(expResult, result); - // TODO review the generated test code and remove the default call to fail. - fail("The test case is a prototype."); + assertTrue("No ID", result.getId() > 0); + assertTrue("No name!", StringUtils.isNotBlank(result.getName())); } }