Tidy up of test cases
This commit is contained in:
@@ -19,7 +19,6 @@
|
||||
*/
|
||||
package com.omertron.themoviedbapi;
|
||||
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.omertron.themoviedbapi.enumeration.MediaType;
|
||||
import com.omertron.themoviedbapi.methods.TmdbAccount;
|
||||
import com.omertron.themoviedbapi.methods.TmdbAuthentication;
|
||||
@@ -79,8 +78,6 @@ import java.net.URL;
|
||||
import java.util.List;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.http.client.HttpClient;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.yamj.api.common.http.SimpleHttpClientBuilder;
|
||||
|
||||
/**
|
||||
@@ -92,11 +89,7 @@ import org.yamj.api.common.http.SimpleHttpClientBuilder;
|
||||
*/
|
||||
public class TheMovieDbApi {
|
||||
|
||||
private static final Logger LOG = LoggerFactory.getLogger(TheMovieDbApi.class);
|
||||
private String apiKey;
|
||||
private HttpTools httpTools;
|
||||
// Jackson JSON configuration
|
||||
private static final ObjectMapper MAPPER = new ObjectMapper();
|
||||
// Constants
|
||||
private static final int YEAR_LENGTH = 4;
|
||||
// Sub-methods
|
||||
@@ -138,7 +131,6 @@ public class TheMovieDbApi {
|
||||
* @throws MovieDbException
|
||||
*/
|
||||
public TheMovieDbApi(String apiKey, HttpClient httpClient) throws MovieDbException {
|
||||
this.apiKey = apiKey;
|
||||
this.httpTools = new HttpTools(httpClient);
|
||||
initialise(apiKey, httpTools);
|
||||
}
|
||||
@@ -687,7 +679,7 @@ public class TheMovieDbApi {
|
||||
* @throws MovieDbException
|
||||
*/
|
||||
public URL createImageUrl(String imagePath, String requiredSize) throws MovieDbException {
|
||||
return tmdbConfiguration.createImageUrl(imagePath, requiredSize);
|
||||
return tmdbConfiguration.getConfig().createImageUrl(imagePath, requiredSize);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -31,7 +31,6 @@ import com.omertron.themoviedbapi.tools.MethodSub;
|
||||
import com.omertron.themoviedbapi.wrapper.WrapperConfig;
|
||||
import com.omertron.themoviedbapi.wrapper.WrapperJobList;
|
||||
import java.io.IOException;
|
||||
import java.net.MalformedURLException;
|
||||
import java.net.URL;
|
||||
import org.yamj.api.common.exception.ApiExceptionType;
|
||||
|
||||
@@ -80,29 +79,6 @@ public class TmdbConfiguration extends AbstractMethod {
|
||||
return config;
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate the full image URL from the size and image path
|
||||
*
|
||||
* @param imagePath
|
||||
* @param requiredSize
|
||||
* @return
|
||||
* @throws MovieDbException
|
||||
*/
|
||||
public URL createImageUrl(String imagePath, String requiredSize) throws MovieDbException {
|
||||
if (!config.isValidSize(requiredSize)) {
|
||||
throw new MovieDbException(ApiExceptionType.INVALID_IMAGE, "Required size '" + requiredSize + "' is not valid");
|
||||
}
|
||||
|
||||
StringBuilder sb = new StringBuilder(config.getBaseUrl());
|
||||
sb.append(requiredSize);
|
||||
sb.append(imagePath);
|
||||
try {
|
||||
return new URL(sb.toString());
|
||||
} catch (MalformedURLException ex) {
|
||||
throw new MovieDbException(ApiExceptionType.INVALID_URL, "Failed to create image URL", sb.toString(), ex);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a list of valid jobs
|
||||
*
|
||||
|
||||
@@ -20,8 +20,12 @@
|
||||
package com.omertron.themoviedbapi.model;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import com.omertron.themoviedbapi.MovieDbException;
|
||||
import java.net.MalformedURLException;
|
||||
import java.net.URL;
|
||||
import java.util.List;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.yamj.api.common.exception.ApiExceptionType;
|
||||
|
||||
/**
|
||||
* @author stuart.boston
|
||||
@@ -180,4 +184,29 @@ public class Configuration extends AbstractJsonMapping {
|
||||
|| isValidProfileSize(sizeToCheck)
|
||||
|| isValidLogoSize(sizeToCheck);
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate the full image URL from the size and image path
|
||||
*
|
||||
* @param imagePath
|
||||
* @param requiredSize
|
||||
* @return
|
||||
* @throws MovieDbException
|
||||
*/
|
||||
public URL createImageUrl(String imagePath, String requiredSize) throws MovieDbException {
|
||||
if (!isValidSize(requiredSize)) {
|
||||
throw new MovieDbException(ApiExceptionType.INVALID_IMAGE, "Required size '" + requiredSize + "' is not valid");
|
||||
}
|
||||
|
||||
StringBuilder sb = new StringBuilder(getBaseUrl());
|
||||
sb.append(requiredSize);
|
||||
sb.append(imagePath);
|
||||
|
||||
try {
|
||||
return new URL(sb.toString());
|
||||
} catch (MalformedURLException ex) {
|
||||
throw new MovieDbException(ApiExceptionType.INVALID_URL, "Failed to create image URL", sb.toString(), ex);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -48,6 +48,10 @@ public final class TmdbResultsList<T> extends AbstractResults {
|
||||
this.results = results;
|
||||
}
|
||||
|
||||
public boolean isEmpty() {
|
||||
return results.isEmpty();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getTotalResults() {
|
||||
if (super.getTotalResults() == 0) {
|
||||
|
||||
@@ -19,15 +19,17 @@
|
||||
*/
|
||||
package com.omertron.themoviedbapi;
|
||||
|
||||
import com.omertron.themoviedbapi.methods.TmdbAccount;
|
||||
import com.omertron.themoviedbapi.methods.TmdbAuthentication;
|
||||
import com.omertron.themoviedbapi.model.Account;
|
||||
import com.omertron.themoviedbapi.model.TokenAuthorisation;
|
||||
import com.omertron.themoviedbapi.model.TokenSession;
|
||||
import com.omertron.themoviedbapi.tools.HttpTools;
|
||||
import java.io.File;
|
||||
import java.util.Properties;
|
||||
import org.apache.http.impl.client.HttpClient;
|
||||
import org.junit.After;
|
||||
import org.junit.AfterClass;
|
||||
import org.apache.http.client.HttpClient;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.junit.Assert.fail;
|
||||
import org.junit.Before;
|
||||
import org.junit.BeforeClass;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.yamj.api.common.http.SimpleHttpClientBuilder;
|
||||
@@ -39,13 +41,15 @@ public class AbstractTests {
|
||||
private static final Properties props = new Properties();
|
||||
private static HttpClient httpClient;
|
||||
private static HttpTools httpTools;
|
||||
// Session informaion
|
||||
private static TokenSession tokenSession = null;
|
||||
private static Account account = null;
|
||||
// Constants
|
||||
protected static final String LANGUAGE_DEFAULT = "";
|
||||
protected static final String LANGUAGE_ENGLISH = "en";
|
||||
protected static final String LANGUAGE_RUSSIAN = "ru";
|
||||
|
||||
@BeforeClass
|
||||
public static void setUpClass() throws MovieDbException {
|
||||
public static final void doConfiguration() throws MovieDbException {
|
||||
TestLogger.Configure();
|
||||
httpClient = new SimpleHttpClientBuilder().build();
|
||||
httpTools = new HttpTools(httpClient);
|
||||
@@ -68,16 +72,30 @@ public class AbstractTests {
|
||||
}
|
||||
}
|
||||
|
||||
@AfterClass
|
||||
public static void tearDownClass() throws MovieDbException {
|
||||
public static final String getSessionId() throws MovieDbException {
|
||||
if (tokenSession == null) {
|
||||
TmdbAuthentication auth = new TmdbAuthentication(getApiKey(), getHttpTools());
|
||||
LOG.info("Test and create a session token for the rest of the tests");
|
||||
// 1: Create a request token
|
||||
TokenAuthorisation token = auth.getAuthorisationToken();
|
||||
assertTrue("Token (auth) is not valid", token.getSuccess());
|
||||
token = auth.getSessionTokenLogin(token, getUsername(), getPassword());
|
||||
assertTrue("Token (login) is not valid", token.getSuccess());
|
||||
// 3: Create the sessions ID
|
||||
tokenSession = auth.getSessionToken(token);
|
||||
assertTrue("Session token is not valid", tokenSession.getSuccess());
|
||||
|
||||
}
|
||||
return tokenSession.getSessionId();
|
||||
}
|
||||
|
||||
@Before
|
||||
public void setUp() throws MovieDbException {
|
||||
}
|
||||
|
||||
@After
|
||||
public void tearDown() throws MovieDbException {
|
||||
public static final int getAccountId() throws MovieDbException {
|
||||
if (account == null) {
|
||||
TmdbAccount instance = new TmdbAccount(getApiKey(), getHttpTools());
|
||||
// Get the account for later tests
|
||||
account = instance.getAccount(tokenSession.getSessionId());
|
||||
}
|
||||
return account.getId();
|
||||
}
|
||||
|
||||
public static HttpClient getHttpClient() {
|
||||
|
||||
@@ -48,11 +48,11 @@ public class TestAccounts extends AbstractTests {
|
||||
|
||||
@BeforeClass
|
||||
public static void setUpClass() throws MovieDbException {
|
||||
doConfiguration();
|
||||
tmdb = new TheMovieDbApi(getApiKey());
|
||||
}
|
||||
|
||||
@Before
|
||||
@Override
|
||||
public void setUp() throws MovieDbException {
|
||||
if (tokenSession == null) {
|
||||
testSessionCreation();
|
||||
|
||||
@@ -21,7 +21,7 @@ package com.omertron.themoviedbapi.methods;
|
||||
|
||||
import com.omertron.themoviedbapi.AbstractTests;
|
||||
import com.omertron.themoviedbapi.MovieDbException;
|
||||
import com.omertron.themoviedbapi.TestLogger;
|
||||
import com.omertron.themoviedbapi.enumeration.MediaType;
|
||||
import com.omertron.themoviedbapi.model.Account;
|
||||
import com.omertron.themoviedbapi.model.MovieDb;
|
||||
import com.omertron.themoviedbapi.model.MovieDbList;
|
||||
@@ -42,7 +42,6 @@ import org.junit.Test;
|
||||
*/
|
||||
public class TmdbAccountTest extends AbstractTests {
|
||||
|
||||
// API
|
||||
private static TmdbAccount instance;
|
||||
// Constants
|
||||
private static final int ID_MOVIE_FIGHT_CLUB = 550;
|
||||
@@ -52,7 +51,7 @@ public class TmdbAccountTest extends AbstractTests {
|
||||
|
||||
@BeforeClass
|
||||
public static void setUpClass() throws MovieDbException {
|
||||
TestLogger.Configure();
|
||||
doConfiguration();
|
||||
instance = new TmdbAccount(getApiKey(), getHttpTools());
|
||||
}
|
||||
|
||||
@@ -61,15 +60,17 @@ public class TmdbAccountTest extends AbstractTests {
|
||||
}
|
||||
|
||||
/**
|
||||
* Test of getAccount method, of class TmdbAccount.
|
||||
* Test of getAccountId method, of class TmdbAccount.
|
||||
*
|
||||
* @throws com.omertron.themoviedbapi.MovieDbException
|
||||
*/
|
||||
@Test
|
||||
public void testGetAccount() throws MovieDbException {
|
||||
LOG.info("getAccount");
|
||||
Account result = instance.getAccount(SESSION_ID_APITESTS);
|
||||
assertEquals("Wrong account returned", ACCOUNT_ID_APITESTS, result.getId());
|
||||
Account result = instance.getAccount(getSessionId());
|
||||
assertNotNull("No account returned", result);
|
||||
// Make sure properties are extracted correctly
|
||||
assertEquals("Wrong username!", getUsername(), result.getUserName());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -80,7 +81,7 @@ public class TmdbAccountTest extends AbstractTests {
|
||||
@Test
|
||||
public void testGetUserLists() throws MovieDbException {
|
||||
LOG.info("getUserLists");
|
||||
List<MovieDbList> result = instance.getUserLists(SESSION_ID_APITESTS, ACCOUNT_ID_APITESTS);
|
||||
List<MovieDbList> result = instance.getUserLists(getSessionId(), getAccountId());
|
||||
assertNotNull("Null list returned", result);
|
||||
}
|
||||
|
||||
@@ -95,16 +96,16 @@ public class TmdbAccountTest extends AbstractTests {
|
||||
|
||||
LOG.info("Check favorite list is empty");
|
||||
// make sure it's empty (because it's just a test account
|
||||
List<MovieDb> favList = instance.getFavoriteMovies(SESSION_ID_APITESTS, ACCOUNT_ID_APITESTS);
|
||||
List<MovieDb> favList = instance.getFavoriteMovies(getSessionId(), getAccountId());
|
||||
assertTrue("Favorite list was not empty!", favList.isEmpty());
|
||||
|
||||
LOG.info("Add movie to list");
|
||||
// add a movie
|
||||
StatusCode status = instance.changeFavoriteStatus(SESSION_ID_APITESTS, ACCOUNT_ID_APITESTS, ID_MOVIE_FIGHT_CLUB, true);
|
||||
StatusCode status = instance.changeFavoriteStatus(getSessionId(), getAccountId(), ID_MOVIE_FIGHT_CLUB, MediaType.MOVIE, true);
|
||||
LOG.info("Add Status: {}", status);
|
||||
|
||||
LOG.info("Get favorite list");
|
||||
favList = instance.getFavoriteMovies(SESSION_ID_APITESTS, ACCOUNT_ID_APITESTS);
|
||||
favList = instance.getFavoriteMovies(getSessionId(), getAccountId());
|
||||
assertNotNull("Empty favorite list returned", favList);
|
||||
assertFalse("Favorite list empty", favList.isEmpty());
|
||||
|
||||
@@ -112,10 +113,10 @@ public class TmdbAccountTest extends AbstractTests {
|
||||
LOG.info("Remove movie(s) from list");
|
||||
for (MovieDb movie : favList) {
|
||||
LOG.info("Removing movie {}-'{}'", movie.getId(), movie.getTitle());
|
||||
status = instance.changeFavoriteStatus(SESSION_ID_APITESTS, ACCOUNT_ID_APITESTS, movie.getId(), false);
|
||||
status = instance.changeFavoriteStatus(getSessionId(), getAccountId(), movie.getId(), MediaType.MOVIE, false);
|
||||
LOG.info("Remove status: {}", status);
|
||||
}
|
||||
assertTrue("Favorite list was not empty", instance.getFavoriteMovies(SESSION_ID_APITESTS, ACCOUNT_ID_APITESTS).isEmpty());
|
||||
assertTrue("Favorite list was not empty", instance.getFavoriteMovies(getSessionId(), getAccountId()).isEmpty());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -135,7 +136,7 @@ public class TmdbAccountTest extends AbstractTests {
|
||||
@Test
|
||||
public void testGetRatedMovies() throws MovieDbException {
|
||||
LOG.info("getRatedMovies");
|
||||
List<MovieDb> result = instance.getRatedMovies(SESSION_ID_APITESTS, ACCOUNT_ID_APITESTS);
|
||||
List<MovieDb> result = instance.getRatedMovies(getSessionId(), getAccountId());
|
||||
assertFalse("No rated movies", result.isEmpty());
|
||||
}
|
||||
|
||||
@@ -150,16 +151,16 @@ public class TmdbAccountTest extends AbstractTests {
|
||||
|
||||
LOG.info("Check list is empty");
|
||||
// make sure it's empty (because it's just a test account
|
||||
List<MovieDb> watchList = instance.getWatchList(SESSION_ID_APITESTS, ACCOUNT_ID_APITESTS);
|
||||
List<MovieDb> watchList = instance.getWatchListMovie(getSessionId(), getAccountId());
|
||||
assertTrue("Watch list was not empty!", watchList.isEmpty());
|
||||
|
||||
LOG.info("Add movie to list");
|
||||
// add a movie
|
||||
StatusCode status = instance.modifyWatchList(SESSION_ID_APITESTS, ACCOUNT_ID_APITESTS, ID_MOVIE_FIGHT_CLUB, true);
|
||||
StatusCode status = instance.modifyWatchList(getSessionId(), getAccountId(), ID_MOVIE_FIGHT_CLUB, MediaType.MOVIE, true);
|
||||
LOG.info("Add Status: {}", status);
|
||||
|
||||
LOG.info("Get watch list");
|
||||
watchList = instance.getWatchList(SESSION_ID_APITESTS, ACCOUNT_ID_APITESTS);
|
||||
watchList = instance.getWatchListMovie(getSessionId(), getAccountId());
|
||||
assertNotNull("Empty watch list returned", watchList);
|
||||
assertFalse("Watchlist list empty", watchList.isEmpty());
|
||||
|
||||
@@ -167,11 +168,11 @@ public class TmdbAccountTest extends AbstractTests {
|
||||
// clean up again
|
||||
for (MovieDb movie : watchList) {
|
||||
LOG.info("Removing movie {}-'{}'", movie.getId(), movie.getTitle());
|
||||
status = instance.modifyWatchList(SESSION_ID_APITESTS, ACCOUNT_ID_APITESTS, movie.getId(), false);
|
||||
status = instance.modifyWatchList(getSessionId(), getAccountId(), movie.getId(), MediaType.MOVIE, false);
|
||||
LOG.info("Remove status: {}", status);
|
||||
}
|
||||
|
||||
assertTrue(instance.getWatchList(SESSION_ID_APITESTS, ACCOUNT_ID_APITESTS).isEmpty());
|
||||
assertTrue(instance.getWatchListMovie(getSessionId(), getAccountId()).isEmpty());
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -21,7 +21,6 @@ package com.omertron.themoviedbapi.methods;
|
||||
|
||||
import com.omertron.themoviedbapi.AbstractTests;
|
||||
import com.omertron.themoviedbapi.MovieDbException;
|
||||
import com.omertron.themoviedbapi.TestLogger;
|
||||
import com.omertron.themoviedbapi.model.TokenAuthorisation;
|
||||
import com.omertron.themoviedbapi.model.TokenSession;
|
||||
import org.junit.AfterClass;
|
||||
@@ -37,7 +36,6 @@ import org.junit.Test;
|
||||
*/
|
||||
public class TmdbAuthenticationTest extends AbstractTests{
|
||||
|
||||
// API
|
||||
private static TmdbAuthentication instance;
|
||||
|
||||
public TmdbAuthenticationTest() {
|
||||
@@ -45,7 +43,7 @@ public class TmdbAuthenticationTest extends AbstractTests{
|
||||
|
||||
@BeforeClass
|
||||
public static void setUpClass() throws MovieDbException {
|
||||
TestLogger.Configure();
|
||||
doConfiguration();
|
||||
instance = new TmdbAuthentication(getApiKey(),getHttpTools());
|
||||
}
|
||||
|
||||
|
||||
@@ -20,8 +20,8 @@
|
||||
package com.omertron.themoviedbapi.methods;
|
||||
|
||||
import com.omertron.themoviedbapi.AbstractTests;
|
||||
import static com.omertron.themoviedbapi.AbstractTests.doConfiguration;
|
||||
import com.omertron.themoviedbapi.MovieDbException;
|
||||
import com.omertron.themoviedbapi.TestLogger;
|
||||
import com.omertron.themoviedbapi.model.Certification;
|
||||
import com.omertron.themoviedbapi.results.TmdbResultsMap;
|
||||
import java.util.List;
|
||||
@@ -37,7 +37,6 @@ import org.junit.Test;
|
||||
*/
|
||||
public class TmdbCertificationsTest extends AbstractTests {
|
||||
|
||||
// API
|
||||
private static TmdbCertifications instance;
|
||||
|
||||
public TmdbCertificationsTest() {
|
||||
@@ -45,7 +44,7 @@ public class TmdbCertificationsTest extends AbstractTests {
|
||||
|
||||
@BeforeClass
|
||||
public static void setUpClass() throws MovieDbException {
|
||||
TestLogger.Configure();
|
||||
doConfiguration();
|
||||
instance = new TmdbCertifications(getApiKey(), getHttpTools());
|
||||
}
|
||||
|
||||
|
||||
@@ -21,9 +21,9 @@ package com.omertron.themoviedbapi.methods;
|
||||
|
||||
import com.omertron.themoviedbapi.AbstractTests;
|
||||
import com.omertron.themoviedbapi.MovieDbException;
|
||||
import com.omertron.themoviedbapi.TestLogger;
|
||||
import com.omertron.themoviedbapi.model.ChangedMovie;
|
||||
import com.omertron.themoviedbapi.model.ChangedMedia;
|
||||
import com.omertron.themoviedbapi.results.TmdbResultsList;
|
||||
import com.omertron.themoviedbapi.tools.MethodBase;
|
||||
import org.junit.AfterClass;
|
||||
import static org.junit.Assert.assertFalse;
|
||||
import static org.junit.Assert.fail;
|
||||
@@ -45,7 +45,7 @@ public class TmdbChangesTest extends AbstractTests {
|
||||
|
||||
@BeforeClass
|
||||
public static void setUpClass() throws MovieDbException {
|
||||
TestLogger.Configure();
|
||||
doConfiguration();
|
||||
instance = new TmdbChanges(getApiKey(), getHttpTools());
|
||||
}
|
||||
|
||||
@@ -54,7 +54,7 @@ public class TmdbChangesTest extends AbstractTests {
|
||||
}
|
||||
|
||||
/**
|
||||
* Test of getMovieChangesList method, of class TmdbChanges.
|
||||
* Test of getChangeList(MOVIE) method, of class TmdbChanges.
|
||||
*
|
||||
* @throws MovieDbException
|
||||
*/
|
||||
@@ -64,12 +64,13 @@ public class TmdbChangesTest extends AbstractTests {
|
||||
int page = 0;
|
||||
String startDate = "";
|
||||
String endDate = "";
|
||||
TmdbResultsList<ChangedMovie> result = instance.getMovieChangesList(page, startDate, endDate);
|
||||
|
||||
TmdbResultsList<ChangedMedia> result = instance.getChangeList(MethodBase.MOVIE, page, startDate, endDate);
|
||||
assertFalse("No movie changes.", result.getResults().isEmpty());
|
||||
}
|
||||
|
||||
/**
|
||||
* Test of getPersonMovieOldChangesList method, of class TheMovieDbApi.
|
||||
* Test of getChangeList(PERSON) method, of class TheMovieDbApi.
|
||||
*
|
||||
* @throws MovieDbException
|
||||
*/
|
||||
@@ -79,7 +80,23 @@ public class TmdbChangesTest extends AbstractTests {
|
||||
int page = 0;
|
||||
String startDate = "";
|
||||
String endDate = "";
|
||||
instance.getPersonChangesList(page, startDate, endDate);
|
||||
TmdbResultsList<ChangedMedia> result = instance.getChangeList(MethodBase.PERSON, 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 getChangeList(TV) method, of class TheMovieDbApi.
|
||||
*
|
||||
* @throws MovieDbException
|
||||
*/
|
||||
@Ignore("Not ready yet")
|
||||
public void testGetTVChangesList() throws MovieDbException {
|
||||
LOG.info("getPersonChangesList");
|
||||
int page = 0;
|
||||
String startDate = "";
|
||||
String endDate = "";
|
||||
TmdbResultsList<ChangedMedia> result = instance.getChangeList(MethodBase.PERSON, page, startDate, endDate);
|
||||
// TODO review the generated test code and remove the default call to fail.
|
||||
fail("The test case is a prototype.");
|
||||
}
|
||||
|
||||
@@ -21,7 +21,6 @@ package com.omertron.themoviedbapi.methods;
|
||||
|
||||
import com.omertron.themoviedbapi.AbstractTests;
|
||||
import com.omertron.themoviedbapi.MovieDbException;
|
||||
import com.omertron.themoviedbapi.TestLogger;
|
||||
import com.omertron.themoviedbapi.model.Artwork;
|
||||
import com.omertron.themoviedbapi.model.CollectionInfo;
|
||||
import com.omertron.themoviedbapi.results.TmdbResultsList;
|
||||
@@ -36,7 +35,6 @@ import org.junit.Test;
|
||||
*/
|
||||
public class TmdbCollectionsTest extends AbstractTests {
|
||||
|
||||
// API
|
||||
private static TmdbCollections instance;
|
||||
private static final int ID_COLLECTION_STAR_WARS = 10;
|
||||
|
||||
@@ -45,7 +43,7 @@ public class TmdbCollectionsTest extends AbstractTests {
|
||||
|
||||
@BeforeClass
|
||||
public static void setUpClass() throws MovieDbException {
|
||||
TestLogger.Configure();
|
||||
doConfiguration();
|
||||
instance = new TmdbCollections(getApiKey(), getHttpTools());
|
||||
}
|
||||
|
||||
|
||||
@@ -21,11 +21,8 @@ package com.omertron.themoviedbapi.methods;
|
||||
|
||||
import com.omertron.themoviedbapi.AbstractTests;
|
||||
import com.omertron.themoviedbapi.MovieDbException;
|
||||
import com.omertron.themoviedbapi.TestLogger;
|
||||
import static com.omertron.themoviedbapi.TheMovieDbApiTest.getApiKey();
|
||||
import static com.omertron.themoviedbapi.TheMovieDbApiTest.LANGUAGE_DEFAULT;
|
||||
import com.omertron.themoviedbapi.model.Company;
|
||||
import com.omertron.themoviedbapi.model.movie.MovieDb;
|
||||
import com.omertron.themoviedbapi.model.MovieDb;
|
||||
import com.omertron.themoviedbapi.results.TmdbResultsList;
|
||||
import org.junit.After;
|
||||
import org.junit.AfterClass;
|
||||
@@ -34,19 +31,13 @@ import static org.junit.Assert.assertTrue;
|
||||
import org.junit.Before;
|
||||
import org.junit.BeforeClass;
|
||||
import org.junit.Test;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.yamj.api.common.http.DefaultPoolingHttpClient;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author stuart.boston
|
||||
*/
|
||||
public class TmdbCompaniesTest extends AbstractTests{
|
||||
public class TmdbCompaniesTest extends AbstractTests {
|
||||
|
||||
// Logger
|
||||
private static final Logger LOG = LoggerFactory.getLogger(TmdbCompaniesTest.class);
|
||||
// API
|
||||
private static TmdbCompanies instance;
|
||||
private static final int ID_COMPANY = 2;
|
||||
|
||||
@@ -55,8 +46,8 @@ public class TmdbCompaniesTest extends AbstractTests{
|
||||
|
||||
@BeforeClass
|
||||
public static void setUpClass() throws MovieDbException {
|
||||
TestLogger.Configure();
|
||||
instance = new TmdbCompanies(getApiKey(),getHttpTools());
|
||||
doConfiguration();
|
||||
instance = new TmdbCompanies(getApiKey(), getHttpTools());
|
||||
}
|
||||
|
||||
@AfterClass
|
||||
@@ -93,6 +84,6 @@ public class TmdbCompaniesTest extends AbstractTests{
|
||||
public void testGetCompanyMovies() throws MovieDbException {
|
||||
LOG.info("getCompanyMovies");
|
||||
TmdbResultsList<MovieDb> result = instance.getCompanyMovies(ID_COMPANY, LANGUAGE_DEFAULT, 0);
|
||||
assertTrue("No company movies found", !result.getResults().isEmpty());
|
||||
assertTrue("No company movies found", !result.isEmpty());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,10 +21,7 @@ package com.omertron.themoviedbapi.methods;
|
||||
|
||||
import com.omertron.themoviedbapi.AbstractTests;
|
||||
import com.omertron.themoviedbapi.MovieDbException;
|
||||
import com.omertron.themoviedbapi.TestLogger;
|
||||
import static com.omertron.themoviedbapi.TheMovieDbApiTest.getApiKey();
|
||||
import com.omertron.themoviedbapi.model.Configuration;
|
||||
import com.omertron.themoviedbapi.model.type.ArtworkType;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.junit.After;
|
||||
import org.junit.AfterClass;
|
||||
@@ -33,9 +30,6 @@ import static org.junit.Assert.assertTrue;
|
||||
import org.junit.Before;
|
||||
import org.junit.BeforeClass;
|
||||
import org.junit.Test;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.yamj.api.common.http.DefaultPoolingHttpClient;
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -43,19 +37,15 @@ import org.yamj.api.common.http.DefaultPoolingHttpClient;
|
||||
*/
|
||||
public class TmdbConfigurationTest extends AbstractTests {
|
||||
|
||||
// Logger
|
||||
private static final Logger LOG = LoggerFactory.getLogger(TmdbConfigurationTest.class);
|
||||
|
||||
// API
|
||||
private static TmdbConfiguration instance;
|
||||
|
||||
public TmdbConfigurationTest() {
|
||||
}
|
||||
|
||||
@BeforeClass
|
||||
public static void setUpClass() {
|
||||
TestLogger.Configure();
|
||||
instance = new TmdbConfiguration(getApiKey(),getHttpTools());
|
||||
public static void setUpClass() throws MovieDbException {
|
||||
doConfiguration();
|
||||
instance = new TmdbConfiguration(getApiKey(), getHttpTools());
|
||||
}
|
||||
|
||||
@AfterClass
|
||||
@@ -98,7 +88,7 @@ public class TmdbConfigurationTest extends AbstractTests {
|
||||
LOG.info("createImageUrl");
|
||||
Configuration config = instance.getConfig();
|
||||
|
||||
String result = config.createImageUrl("http://mediaplayersite.com/image.jpg", ArtworkType.POSTER, "original").toString();
|
||||
String result = config.createImageUrl("http://mediaplayersite.com/image.jpg", "original").toString();
|
||||
assertTrue("Error compiling image URL", !result.isEmpty());
|
||||
}
|
||||
|
||||
|
||||
@@ -21,19 +21,13 @@ package com.omertron.themoviedbapi.methods;
|
||||
|
||||
import com.omertron.themoviedbapi.AbstractTests;
|
||||
import com.omertron.themoviedbapi.MovieDbException;
|
||||
import com.omertron.themoviedbapi.TestLogger;
|
||||
import static com.omertron.themoviedbapi.TheMovieDbApiTest.getApiKey();
|
||||
import com.omertron.themoviedbapi.model.person.PersonCredits;
|
||||
import com.omertron.themoviedbapi.model.TBD_PersonCredits;
|
||||
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.fail;
|
||||
import org.junit.Before;
|
||||
import org.junit.BeforeClass;
|
||||
import org.junit.Test;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.yamj.api.common.http.DefaultPoolingHttpClient;
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -41,9 +35,6 @@ import org.yamj.api.common.http.DefaultPoolingHttpClient;
|
||||
*/
|
||||
public class TmdbCreditsTest extends AbstractTests{
|
||||
|
||||
// Logger
|
||||
private static final Logger LOG = LoggerFactory.getLogger(TmdbCreditsTest.class);
|
||||
// API
|
||||
private static TmdbCredits instance;
|
||||
|
||||
public TmdbCreditsTest() {
|
||||
@@ -51,7 +42,7 @@ public class TmdbCreditsTest extends AbstractTests{
|
||||
|
||||
@BeforeClass
|
||||
public static void setUpClass() throws MovieDbException {
|
||||
TestLogger.Configure();
|
||||
doConfiguration();
|
||||
instance = new TmdbCredits(getApiKey(),getHttpTools());
|
||||
}
|
||||
|
||||
@@ -77,10 +68,11 @@ public class TmdbCreditsTest extends AbstractTests{
|
||||
LOG.info("getCreditInfo");
|
||||
String creditId = "525346f619c29579400d4145";
|
||||
String language = "";
|
||||
PersonCredits result = instance.getCreditInfo(creditId, language);
|
||||
assertEquals("Wrong name", "Sean Bean", result.getPerson().getName());
|
||||
assertEquals("Wrong job", "Actor", result.getJob());
|
||||
assertFalse("No seasons", result.getMedia().getSeasons().isEmpty());
|
||||
TBD_PersonCredits result = instance.getCreditInfo(creditId, language);
|
||||
// assertEquals("Wrong name", "Sean Bean", result.getPerson().getName());
|
||||
// assertEquals("Wrong job", "Actor", result.getJob());
|
||||
// assertFalse("No seasons", result.getMedia().getSeasons().isEmpty());
|
||||
fail("The test case is a prototype.");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -21,11 +21,8 @@ package com.omertron.themoviedbapi.methods;
|
||||
|
||||
import com.omertron.themoviedbapi.AbstractTests;
|
||||
import com.omertron.themoviedbapi.MovieDbException;
|
||||
import com.omertron.themoviedbapi.TestLogger;
|
||||
import static com.omertron.themoviedbapi.TheMovieDbApiTest.getApiKey();
|
||||
import static com.omertron.themoviedbapi.TheMovieDbApiTest.LANGUAGE_ENGLISH;
|
||||
import com.omertron.themoviedbapi.model.discover.Discover;
|
||||
import com.omertron.themoviedbapi.model.movie.MovieDb;
|
||||
import com.omertron.themoviedbapi.model.Discover;
|
||||
import com.omertron.themoviedbapi.model.MovieDb;
|
||||
import com.omertron.themoviedbapi.results.TmdbResultsList;
|
||||
import org.junit.After;
|
||||
import org.junit.AfterClass;
|
||||
@@ -33,9 +30,6 @@ import static org.junit.Assert.assertFalse;
|
||||
import org.junit.Before;
|
||||
import org.junit.BeforeClass;
|
||||
import org.junit.Test;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.yamj.api.common.http.DefaultPoolingHttpClient;
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -43,9 +37,6 @@ import org.yamj.api.common.http.DefaultPoolingHttpClient;
|
||||
*/
|
||||
public class TmdbDiscoverTest extends AbstractTests {
|
||||
|
||||
// Logger
|
||||
private static final Logger LOG = LoggerFactory.getLogger(TmdbDiscoverTest.class);
|
||||
// API
|
||||
private static TmdbDiscover instance;
|
||||
|
||||
public TmdbDiscoverTest() {
|
||||
@@ -53,7 +44,7 @@ public class TmdbDiscoverTest extends AbstractTests {
|
||||
|
||||
@BeforeClass
|
||||
public static void setUpClass() throws MovieDbException {
|
||||
TestLogger.Configure();
|
||||
doConfiguration();
|
||||
instance = new TmdbDiscover(getApiKey(),getHttpTools());
|
||||
}
|
||||
|
||||
@@ -80,7 +71,7 @@ public class TmdbDiscoverTest extends AbstractTests {
|
||||
Discover discover = new Discover();
|
||||
discover.year(2013).language(LANGUAGE_ENGLISH);
|
||||
|
||||
TmdbResultsList<MovieDb> result = instance.getDiscoverMovie(discover);
|
||||
TmdbResultsList<MovieDb> result = instance.getDiscoverMovies(discover);
|
||||
assertFalse("No movies discovered", result.getResults().isEmpty());
|
||||
}
|
||||
|
||||
@@ -95,7 +86,7 @@ public class TmdbDiscoverTest extends AbstractTests {
|
||||
Discover discover = new Discover();
|
||||
discover.year(2013).language(LANGUAGE_ENGLISH);
|
||||
|
||||
TmdbResultsList<MovieDb> result = instance.getDiscoverMovie(discover);
|
||||
TmdbResultsList<MovieDb> result = instance.getDiscoverMovies(discover);
|
||||
assertFalse("No TV shows discovered", result.getResults().isEmpty());
|
||||
}
|
||||
|
||||
|
||||
@@ -21,29 +21,20 @@ package com.omertron.themoviedbapi.methods;
|
||||
|
||||
import com.omertron.themoviedbapi.AbstractTests;
|
||||
import com.omertron.themoviedbapi.MovieDbException;
|
||||
import com.omertron.themoviedbapi.TestLogger;
|
||||
import static com.omertron.themoviedbapi.TheMovieDbApiTest.getApiKey();
|
||||
import com.omertron.themoviedbapi.model.FindResults;
|
||||
import org.junit.After;
|
||||
import org.junit.AfterClass;
|
||||
import static org.junit.Assert.assertFalse;
|
||||
import static org.junit.Assert.fail;
|
||||
import org.junit.Before;
|
||||
import org.junit.BeforeClass;
|
||||
import org.junit.Test;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.yamj.api.common.http.DefaultPoolingHttpClient;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author stuart.boston
|
||||
* @author Luca Tagliani
|
||||
*/
|
||||
*/
|
||||
public class TmdbFindTest extends AbstractTests {
|
||||
|
||||
// Logger
|
||||
private static final Logger LOG = LoggerFactory.getLogger(TmdbFindTest.class);
|
||||
// API
|
||||
private static TmdbFind instance;
|
||||
|
||||
public TmdbFindTest() {
|
||||
@@ -51,8 +42,8 @@ public class TmdbFindTest extends AbstractTests {
|
||||
|
||||
@BeforeClass
|
||||
public static void setUpClass() throws MovieDbException {
|
||||
TestLogger.Configure();
|
||||
instance = new TmdbFind(getApiKey(),getHttpTools());
|
||||
doConfiguration();
|
||||
instance = new TmdbFind(getApiKey(), getHttpTools());
|
||||
}
|
||||
|
||||
@AfterClass
|
||||
@@ -75,23 +66,25 @@ public class TmdbFindTest extends AbstractTests {
|
||||
@Test
|
||||
public void testFindMoviesImdbID() throws MovieDbException {
|
||||
LOG.info("findMoviesImdbID");
|
||||
FindResults result = instance.find("tt0196229", TmdbFind.ExternalSource.imdb_id, "it");
|
||||
assertFalse("No movie for id.", result.getMovieResults().isEmpty());
|
||||
// TBD_FindResults result = instance.find("tt0196229", TBD_ExternalSource.imdb_id, "it");
|
||||
// assertFalse("No movie for id.", result.getMovieResults().isEmpty());
|
||||
fail("The test case is a prototype.");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testFindTvSeriesImdbID() throws MovieDbException {
|
||||
LOG.info("findTvSeriesImdbID");
|
||||
FindResults result = instance.find("tt1219024", TmdbFind.ExternalSource.imdb_id, "it");
|
||||
assertFalse("No tv for id.", result.getTvResults().isEmpty());
|
||||
// TBD_FindResults result = instance.find("tt1219024", TBD_ExternalSource.imdb_id, "it");
|
||||
// assertFalse("No tv for id.", result.getTvResults().isEmpty());
|
||||
fail("The test case is a prototype.");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testFindPersonImdbID() throws MovieDbException {
|
||||
LOG.info("findPersonImdbID");
|
||||
FindResults result = instance.find("nm0001774", TmdbFind.ExternalSource.imdb_id, "it");
|
||||
assertFalse("No person for id.", result.getPersonResults().isEmpty());
|
||||
// TBD_FindResults result = instance.find("nm0001774", TBD_ExternalSource.imdb_id, "it");
|
||||
// assertFalse("No person for id.", result.getPersonResults().isEmpty());
|
||||
fail("The test case is a prototype.");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -21,11 +21,8 @@ package com.omertron.themoviedbapi.methods;
|
||||
|
||||
import com.omertron.themoviedbapi.AbstractTests;
|
||||
import com.omertron.themoviedbapi.MovieDbException;
|
||||
import com.omertron.themoviedbapi.TestLogger;
|
||||
import static com.omertron.themoviedbapi.TheMovieDbApiTest.getApiKey();
|
||||
import static com.omertron.themoviedbapi.TheMovieDbApiTest.LANGUAGE_DEFAULT;
|
||||
import com.omertron.themoviedbapi.model.Genre;
|
||||
import com.omertron.themoviedbapi.model.movie.MovieDb;
|
||||
import com.omertron.themoviedbapi.model.MovieDb;
|
||||
import com.omertron.themoviedbapi.results.TmdbResultsList;
|
||||
import org.junit.After;
|
||||
import org.junit.AfterClass;
|
||||
@@ -33,9 +30,6 @@ import static org.junit.Assert.assertTrue;
|
||||
import org.junit.Before;
|
||||
import org.junit.BeforeClass;
|
||||
import org.junit.Test;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.yamj.api.common.http.DefaultPoolingHttpClient;
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -43,9 +37,6 @@ import org.yamj.api.common.http.DefaultPoolingHttpClient;
|
||||
*/
|
||||
public class TmdbGenresTest extends AbstractTests {
|
||||
|
||||
// Logger
|
||||
private static final Logger LOG = LoggerFactory.getLogger(TmdbGenresTest.class);
|
||||
// API
|
||||
private static TmdbGenres instance;
|
||||
private static final int ID_GENRE_ACTION = 28;
|
||||
|
||||
@@ -54,8 +45,8 @@ public class TmdbGenresTest extends AbstractTests {
|
||||
|
||||
@BeforeClass
|
||||
public static void setUpClass() throws MovieDbException {
|
||||
TestLogger.Configure();
|
||||
instance = new TmdbGenres(getApiKey(),getHttpTools());
|
||||
doConfiguration();
|
||||
instance = new TmdbGenres(getApiKey(), getHttpTools());
|
||||
}
|
||||
|
||||
@AfterClass
|
||||
@@ -91,7 +82,7 @@ public class TmdbGenresTest extends AbstractTests {
|
||||
public void testGetGenreMovies() throws MovieDbException {
|
||||
LOG.info("getGenreMovies");
|
||||
TmdbResultsList<MovieDb> result = instance.getGenreMovies(ID_GENRE_ACTION, LANGUAGE_DEFAULT, 0, Boolean.TRUE);
|
||||
assertTrue("No genre movies found", !result.getResults().isEmpty());
|
||||
assertTrue("No genre movies found", !result.isEmpty());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,82 +0,0 @@
|
||||
/*
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
package com.omertron.themoviedbapi.methods;
|
||||
|
||||
import com.omertron.themoviedbapi.AbstractTests;
|
||||
import com.omertron.themoviedbapi.MovieDbException;
|
||||
import com.omertron.themoviedbapi.TestLogger;
|
||||
import static com.omertron.themoviedbapi.TheMovieDbApiTest.getApiKey();
|
||||
import com.omertron.themoviedbapi.model.JobDepartment;
|
||||
import com.omertron.themoviedbapi.results.TmdbResultsList;
|
||||
import org.junit.After;
|
||||
import org.junit.AfterClass;
|
||||
import static org.junit.Assert.assertFalse;
|
||||
import org.junit.Before;
|
||||
import org.junit.BeforeClass;
|
||||
import org.junit.Test;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.yamj.api.common.http.DefaultPoolingHttpClient;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author stuart.boston
|
||||
*/
|
||||
public class TmdbJobsTest extends AbstractTests {
|
||||
|
||||
// Logger
|
||||
private static final Logger LOG = LoggerFactory.getLogger(TmdbGenresTest.class);
|
||||
// API
|
||||
private static TmdbJobs tmdb;
|
||||
|
||||
public TmdbJobsTest() {
|
||||
}
|
||||
|
||||
@BeforeClass
|
||||
public static void setUpClass() throws MovieDbException {
|
||||
TestLogger.Configure();
|
||||
tmdb = new TmdbJobs(getApiKey(),getHttpTools());
|
||||
}
|
||||
|
||||
@AfterClass
|
||||
public static void tearDownClass() {
|
||||
}
|
||||
|
||||
@Before
|
||||
public void setUp() {
|
||||
}
|
||||
|
||||
@After
|
||||
public void tearDown() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Test of getJobs method, of class TheMovieDbApi.
|
||||
*
|
||||
* @throws MovieDbException
|
||||
*/
|
||||
@Test
|
||||
public void testGetJobs() throws MovieDbException {
|
||||
LOG.info("getJobs");
|
||||
TmdbResultsList<JobDepartment> result = tmdb.getJobs();
|
||||
assertFalse("No jobs found", result.getResults().isEmpty());
|
||||
}
|
||||
|
||||
}
|
||||
@@ -21,11 +21,8 @@ package com.omertron.themoviedbapi.methods;
|
||||
|
||||
import com.omertron.themoviedbapi.AbstractTests;
|
||||
import com.omertron.themoviedbapi.MovieDbException;
|
||||
import com.omertron.themoviedbapi.TestLogger;
|
||||
import static com.omertron.themoviedbapi.TheMovieDbApiTest.getApiKey();
|
||||
import static com.omertron.themoviedbapi.TheMovieDbApiTest.LANGUAGE_DEFAULT;
|
||||
import com.omertron.themoviedbapi.model.Keyword;
|
||||
import com.omertron.themoviedbapi.model.movie.MovieDbBasic;
|
||||
import com.omertron.themoviedbapi.model.KeywordMovie;
|
||||
import com.omertron.themoviedbapi.results.TmdbResultsList;
|
||||
import org.junit.After;
|
||||
import org.junit.AfterClass;
|
||||
@@ -34,9 +31,6 @@ import static org.junit.Assert.assertFalse;
|
||||
import org.junit.Before;
|
||||
import org.junit.BeforeClass;
|
||||
import org.junit.Test;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.yamj.api.common.http.DefaultPoolingHttpClient;
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -44,9 +38,6 @@ import org.yamj.api.common.http.DefaultPoolingHttpClient;
|
||||
*/
|
||||
public class TmdbKeywordsTest extends AbstractTests{
|
||||
|
||||
// Logger
|
||||
private static final Logger LOG = LoggerFactory.getLogger(TmdbGenresTest.class);
|
||||
// API
|
||||
private static TmdbKeywords tmdb;
|
||||
private static final String ID_KEYWORD = "1721";
|
||||
|
||||
@@ -55,7 +46,7 @@ public class TmdbKeywordsTest extends AbstractTests{
|
||||
|
||||
@BeforeClass
|
||||
public static void setUpClass() throws MovieDbException {
|
||||
TestLogger.Configure();
|
||||
doConfiguration();
|
||||
tmdb = new TmdbKeywords(getApiKey(),getHttpTools());
|
||||
}
|
||||
|
||||
@@ -92,8 +83,8 @@ public class TmdbKeywordsTest extends AbstractTests{
|
||||
public void testGetKeywordMovies() throws MovieDbException {
|
||||
LOG.info("getKeywordMovies");
|
||||
int page = 0;
|
||||
TmdbResultsList<MovieDbBasic> result = tmdb.getKeywordMovies(ID_KEYWORD, LANGUAGE_DEFAULT, page);
|
||||
assertFalse("No keyword movies found", result.getResults().isEmpty());
|
||||
TmdbResultsList<KeywordMovie> result = tmdb.getKeywordMovies(ID_KEYWORD, LANGUAGE_DEFAULT, page);
|
||||
assertFalse("No keyword movies found", result.isEmpty());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -21,12 +21,9 @@ package com.omertron.themoviedbapi.methods;
|
||||
|
||||
import com.omertron.themoviedbapi.AbstractTests;
|
||||
import com.omertron.themoviedbapi.MovieDbException;
|
||||
import com.omertron.themoviedbapi.TestLogger;
|
||||
import static com.omertron.themoviedbapi.TheMovieDbApiTest.getApiKey();
|
||||
import static com.omertron.themoviedbapi.TheMovieDbApiTest.SESSION_ID_APITESTS;
|
||||
import com.omertron.themoviedbapi.model.MovieDbList;
|
||||
import com.omertron.themoviedbapi.model.StatusCode;
|
||||
import com.omertron.themoviedbapi.model.StatusCodeList;
|
||||
import com.omertron.themoviedbapi.model.movie.MovieDbList;
|
||||
import com.omertron.themoviedbapi.tools.MethodSub;
|
||||
import org.junit.After;
|
||||
import org.junit.AfterClass;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
@@ -38,16 +35,10 @@ import org.junit.FixMethodOrder;
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
import org.junit.runners.MethodSorters;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.yamj.api.common.http.DefaultPoolingHttpClient;
|
||||
|
||||
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
|
||||
public class TmdbListsTest extends AbstractTests{
|
||||
public class TmdbListsTest extends AbstractTests {
|
||||
|
||||
// Logger
|
||||
private static final Logger LOG = LoggerFactory.getLogger(TmdbGenresTest.class);
|
||||
// API
|
||||
private static TmdbLists instance;
|
||||
|
||||
public TmdbListsTest() {
|
||||
@@ -55,8 +46,8 @@ public class TmdbListsTest extends AbstractTests{
|
||||
|
||||
@BeforeClass
|
||||
public static void setUpClass() throws MovieDbException {
|
||||
TestLogger.Configure();
|
||||
instance = new TmdbLists(getApiKey(),getHttpTools());
|
||||
doConfiguration();
|
||||
instance = new TmdbLists(getApiKey(), getHttpTools());
|
||||
}
|
||||
|
||||
@AfterClass
|
||||
@@ -81,10 +72,10 @@ public class TmdbListsTest extends AbstractTests{
|
||||
LOG.info("createList");
|
||||
String name = "My Totally Awesome List";
|
||||
String description = "This list was created to share all of the totally awesome movies I've seen.";
|
||||
StatusCodeList result = instance.createList(SESSION_ID_APITESTS, name, description);
|
||||
LOG.info(result.toString());
|
||||
String result = instance.createList(getSessionId(), name, description);
|
||||
LOG.info(result);
|
||||
// TODO review the generated test code and remove the default call to fail.
|
||||
// fail("The test case is a prototype.");
|
||||
fail("The test case is a prototype.");
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -111,7 +102,7 @@ public class TmdbListsTest extends AbstractTests{
|
||||
String listId = "";
|
||||
Integer movieId = null;
|
||||
StatusCode expResult = null;
|
||||
StatusCode result = instance.addMovieToList(SESSION_ID_APITESTS, listId, movieId);
|
||||
StatusCode result = instance.modifyMovieList(getSessionId(), listId, movieId, MethodSub.MOVIE);
|
||||
assertEquals(expResult, result);
|
||||
// TODO review the generated test code and remove the default call to fail.
|
||||
fail("The test case is a prototype.");
|
||||
@@ -145,7 +136,7 @@ public class TmdbListsTest extends AbstractTests{
|
||||
String listId = "";
|
||||
Integer movieId = null;
|
||||
StatusCode expResult = null;
|
||||
StatusCode result = instance.removeMovieFromList(SESSION_ID_APITESTS, listId, movieId);
|
||||
StatusCode result = instance.modifyMovieList(getSessionId(), listId, movieId, MethodSub.MOVIE);
|
||||
assertEquals(expResult, result);
|
||||
// TODO review the generated test code and remove the default call to fail.
|
||||
fail("The test case is a prototype.");
|
||||
@@ -161,7 +152,7 @@ public class TmdbListsTest extends AbstractTests{
|
||||
LOG.info("deleteMovieList");
|
||||
String listId = "";
|
||||
StatusCode expResult = null;
|
||||
StatusCode result = instance.deleteMovieList(SESSION_ID_APITESTS, listId);
|
||||
StatusCode result = instance.deleteMovieList(getSessionId(), listId);
|
||||
assertEquals(expResult, result);
|
||||
// TODO review the generated test code and remove the default call to fail.
|
||||
fail("The test case is a prototype.");
|
||||
|
||||
@@ -21,26 +21,15 @@ package com.omertron.themoviedbapi.methods;
|
||||
|
||||
import com.omertron.themoviedbapi.AbstractTests;
|
||||
import com.omertron.themoviedbapi.MovieDbException;
|
||||
import com.omertron.themoviedbapi.TestLogger;
|
||||
import static com.omertron.themoviedbapi.TheMovieDbApiTest.ACCOUNT_ID_APITESTS;
|
||||
import static com.omertron.themoviedbapi.TheMovieDbApiTest.getApiKey();
|
||||
import static com.omertron.themoviedbapi.TheMovieDbApiTest.LANGUAGE_DEFAULT;
|
||||
import static com.omertron.themoviedbapi.TheMovieDbApiTest.LANGUAGE_ENGLISH;
|
||||
import static com.omertron.themoviedbapi.TheMovieDbApiTest.SESSION_ID_APITESTS;
|
||||
import com.omertron.themoviedbapi.model.AlternativeTitle;
|
||||
import com.omertron.themoviedbapi.model.Artwork;
|
||||
import com.omertron.themoviedbapi.model.ChangedItem;
|
||||
import com.omertron.themoviedbapi.model.Keyword;
|
||||
import com.omertron.themoviedbapi.model.MovieDb;
|
||||
import com.omertron.themoviedbapi.model.MovieList;
|
||||
import com.omertron.themoviedbapi.model.ReleaseInfo;
|
||||
import com.omertron.themoviedbapi.model.Review;
|
||||
import com.omertron.themoviedbapi.model.Trailer;
|
||||
import com.omertron.themoviedbapi.model.Translation;
|
||||
import com.omertron.themoviedbapi.model.movie.MovieDb;
|
||||
import com.omertron.themoviedbapi.model.movie.MovieList;
|
||||
import com.omertron.themoviedbapi.model.movie.MovieState;
|
||||
import com.omertron.themoviedbapi.model.person.PersonMovieOld;
|
||||
import com.omertron.themoviedbapi.model.Video;
|
||||
import com.omertron.themoviedbapi.results.TmdbResultsList;
|
||||
import com.omertron.themoviedbapi.results.TmdbResultsMap;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
import org.junit.AfterClass;
|
||||
@@ -48,17 +37,16 @@ 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.BeforeClass;
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author stuart.boston
|
||||
*/
|
||||
public class TmdbMoviesTest extends AbstractTests{
|
||||
public class TmdbMoviesTest extends AbstractTests {
|
||||
|
||||
// API
|
||||
private static TmdbMovies instance;
|
||||
private static final int ID_MOVIE_BLADE_RUNNER = 78;
|
||||
private static final int ID_MOVIE_THE_AVENGERS = 24428;
|
||||
@@ -68,8 +56,9 @@ public class TmdbMoviesTest extends AbstractTests{
|
||||
|
||||
@BeforeClass
|
||||
public static void setUpClass() throws MovieDbException {
|
||||
TestLogger.Configure();
|
||||
instance = new TmdbMovies(getApiKey(),getHttpTools());
|
||||
doConfiguration();
|
||||
instance = new TmdbMovies(getApiKey(), getHttpTools());
|
||||
|
||||
}
|
||||
|
||||
@AfterClass
|
||||
@@ -126,25 +115,29 @@ public class TmdbMoviesTest extends AbstractTests{
|
||||
@Test
|
||||
public void testGetMovieCasts() throws MovieDbException {
|
||||
LOG.info("getMovieCasts");
|
||||
TmdbResultsList<PersonMovieOld> people = instance.getMovieCredits(ID_MOVIE_BLADE_RUNNER, "alternative_titles,casts,images,keywords,releases,trailers,translations,similar_movies,reviews,lists");
|
||||
assertTrue("No cast information", people.getResults().size() > 0);
|
||||
/*
|
||||
TmdbResultsList<PersonMovieOld> people = instance.getMovieCredits(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;
|
||||
String name1 = "Harrison Ford";
|
||||
String name2 = "Charles Knode";
|
||||
boolean foundName1 = Boolean.FALSE;
|
||||
boolean foundName2 = Boolean.FALSE;
|
||||
|
||||
for (PersonMovieOld person : people.getResults()) {
|
||||
if (!foundName1 && person.getName().equalsIgnoreCase(name1)) {
|
||||
foundName1 = Boolean.TRUE;
|
||||
}
|
||||
for (PersonMovieOld 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);
|
||||
*/
|
||||
fail("The test case is a prototype.");
|
||||
|
||||
if (!foundName2 && person.getName().equalsIgnoreCase(name2)) {
|
||||
foundName2 = Boolean.TRUE;
|
||||
}
|
||||
}
|
||||
assertTrue("Couldn't find " + name1, foundName1);
|
||||
assertTrue("Couldn't find " + name2, foundName2);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -192,7 +185,7 @@ public class TmdbMoviesTest extends AbstractTests{
|
||||
@Test
|
||||
public void testGetMovieTrailers() throws MovieDbException {
|
||||
LOG.info("getMovieTrailers");
|
||||
TmdbResultsList<Trailer> result = instance.getMovieTrailers(ID_MOVIE_BLADE_RUNNER, "");
|
||||
TmdbResultsList<Video> result = instance.getMovieTrailers(ID_MOVIE_BLADE_RUNNER, "");
|
||||
assertFalse("Movie trailers missing", result.getResults().isEmpty());
|
||||
}
|
||||
|
||||
@@ -220,19 +213,6 @@ public class TmdbMoviesTest extends AbstractTests{
|
||||
assertTrue("No similar movies found", !result.getResults().isEmpty());
|
||||
}
|
||||
|
||||
/**
|
||||
* Test of getReview method, of class TheMovieDbApi.
|
||||
*
|
||||
* @throws MovieDbException
|
||||
*/
|
||||
@Test
|
||||
public void testGetReviews() throws MovieDbException {
|
||||
LOG.info("getReviews");
|
||||
int page = 0;
|
||||
TmdbResultsList<Review> result = instance.getReviews(ID_MOVIE_THE_AVENGERS, LANGUAGE_DEFAULT, page);
|
||||
assertFalse("No reviews found", result.getResults().isEmpty());
|
||||
}
|
||||
|
||||
/**
|
||||
* Test of getMovieLists method, of class TmdbMovie.
|
||||
*
|
||||
@@ -246,28 +226,6 @@ public class TmdbMoviesTest extends AbstractTests{
|
||||
assertTrue("No results found", result.getResults().size() > 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test of getMovieChanges method,of class TheMovieDbApi
|
||||
*
|
||||
* @throws MovieDbException
|
||||
*/
|
||||
@Ignore("Do not test this until it is fixed")
|
||||
public void testGetMovieChanges() throws MovieDbException {
|
||||
LOG.info("getMovieChanges");
|
||||
|
||||
String startDate = "";
|
||||
String endDate = null;
|
||||
|
||||
// Get some popular movies
|
||||
TmdbResultsList<MovieDb> movieList = instance.getPopularMovieList(LANGUAGE_DEFAULT, 0);
|
||||
for (MovieDb movie : movieList.getResults()) {
|
||||
TmdbResultsMap<String, List<ChangedItem>> result = instance.getMovieChanges(movie.getId(), startDate, endDate);
|
||||
LOG.info("{} has {} changes.", movie.getTitle(), result.getResults().size());
|
||||
assertTrue("No changes found", result.getResults().size() > 0);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Test of getLatestMovie method, of class TheMovieDbApi.
|
||||
*
|
||||
@@ -332,7 +290,8 @@ public class TmdbMoviesTest extends AbstractTests{
|
||||
/**
|
||||
* Test of postMovieRating method, of class TheMovieDbApi.
|
||||
*
|
||||
* TODO: Cannot be tested without a HTTP authorisation: http://help.themoviedb.org/kb/api/user-authentication /**
|
||||
* TODO: Cannot be tested without a HTTP authorisation:
|
||||
* http://help.themoviedb.org/kb/api/user-authentication /**
|
||||
*
|
||||
* @throws MovieDbException
|
||||
*/
|
||||
@@ -342,7 +301,7 @@ public class TmdbMoviesTest extends AbstractTests{
|
||||
Integer movieID = 68724;
|
||||
Integer rating = new Random().nextInt(10) + 1;
|
||||
|
||||
boolean wasPosted = instance.postMovieRating(SESSION_ID_APITESTS, movieID, rating);
|
||||
boolean wasPosted = instance.postMovieRating(getSessionId(), movieID, rating);
|
||||
assertTrue("Failed to post rating", wasPosted);
|
||||
|
||||
try {
|
||||
@@ -353,8 +312,8 @@ public class TmdbMoviesTest extends AbstractTests{
|
||||
}
|
||||
|
||||
// get all rated movies
|
||||
TmdbAccount account = new TmdbAccount(getApiKey(),getHttpTools());
|
||||
List<MovieDb> ratedMovies = account.getRatedMovies(SESSION_ID_APITESTS, ACCOUNT_ID_APITESTS);
|
||||
TmdbAccount account = new TmdbAccount(getApiKey(), getHttpTools());
|
||||
List<MovieDb> ratedMovies = account.getRatedMovies(getSessionId(), getAccountId());
|
||||
assertTrue(ratedMovies.size() > 0);
|
||||
|
||||
// make sure that we find the movie and it is rated correctly
|
||||
@@ -377,31 +336,7 @@ public class TmdbMoviesTest extends AbstractTests{
|
||||
@Test
|
||||
public void testGetMovieCredits() throws MovieDbException {
|
||||
LOG.info("getMovieCredits");
|
||||
TmdbResultsList<PersonMovieOld> result = instance.getMovieCredits(ID_MOVIE_BLADE_RUNNER, "");
|
||||
assertFalse("No credits returned", result.getResults().isEmpty());
|
||||
}
|
||||
|
||||
/**
|
||||
* Test of getMovieStatus method, of class TmdbMovies.
|
||||
*
|
||||
* @throws com.omertron.themoviedbapi.MovieDbException
|
||||
*/
|
||||
@Test
|
||||
public void testGetMovieStatus() throws MovieDbException {
|
||||
LOG.info("getMovieStatus");
|
||||
// This movie should be rated
|
||||
MovieState result = instance.getMovieStatus(SESSION_ID_APITESTS, ID_MOVIE_BLADE_RUNNER);
|
||||
assertNotNull("No state returned", result);
|
||||
assertFalse("Movie is favourited", result.isFavorite());
|
||||
assertFalse("Movie is not rated", result.getRating() < 0);
|
||||
assertFalse("Movie is watch listed", result.isWatchlist());
|
||||
|
||||
// This movie should not be rated
|
||||
result = instance.getMovieStatus(SESSION_ID_APITESTS, ID_MOVIE_THE_AVENGERS);
|
||||
assertNotNull("No state returned", result);
|
||||
assertFalse("Movie is favourited", result.isFavorite());
|
||||
assertFalse("Movie is rated", result.getRating() > -1);
|
||||
assertFalse("Movie is watch listed", result.isWatchlist());
|
||||
fail("The test case is a prototype.");
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -413,7 +348,7 @@ public class TmdbMoviesTest extends AbstractTests{
|
||||
public void testPostMovieRating() throws MovieDbException {
|
||||
LOG.info("postMovieRating");
|
||||
Integer rating = 10;
|
||||
boolean result = instance.postMovieRating(SESSION_ID_APITESTS, ID_MOVIE_BLADE_RUNNER, rating);
|
||||
boolean result = instance.postMovieRating(getSessionId(), ID_MOVIE_BLADE_RUNNER, rating);
|
||||
assertEquals("Failed to set rating", true, result);
|
||||
}
|
||||
|
||||
|
||||
@@ -22,9 +22,9 @@ package com.omertron.themoviedbapi.methods;
|
||||
import com.omertron.themoviedbapi.AbstractTests;
|
||||
import com.omertron.themoviedbapi.MovieDbException;
|
||||
import com.omertron.themoviedbapi.TestLogger;
|
||||
import com.omertron.themoviedbapi.model.tv.Network;
|
||||
import com.omertron.themoviedbapi.model.TBD_Network;
|
||||
import org.junit.AfterClass;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.fail;
|
||||
import org.junit.BeforeClass;
|
||||
import org.junit.Test;
|
||||
|
||||
@@ -58,8 +58,9 @@ public class TmdbNetworksTest extends AbstractTests {
|
||||
@Test
|
||||
public void testGetNetworkInfo() throws MovieDbException {
|
||||
LOG.info("getNetworkInfo");
|
||||
Network result = instance.getNetworkInfo(1);
|
||||
assertEquals("Wrong network returned", "Fuji Television", result.getName());
|
||||
TBD_Network result = instance.getNetworkInfo(1);
|
||||
// assertEquals("Wrong network returned", "Fuji Television", result.getName());
|
||||
fail("The test case is a prototype.");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -21,39 +21,26 @@ package com.omertron.themoviedbapi.methods;
|
||||
|
||||
import com.omertron.themoviedbapi.AbstractTests;
|
||||
import com.omertron.themoviedbapi.MovieDbException;
|
||||
import com.omertron.themoviedbapi.TestLogger;
|
||||
import static com.omertron.themoviedbapi.TheMovieDbApiTest.getApiKey();
|
||||
import static com.omertron.themoviedbapi.TheMovieDbApiTest.LANGUAGE_DEFAULT;
|
||||
import com.omertron.themoviedbapi.model.Artwork;
|
||||
import com.omertron.themoviedbapi.model.person.NewCast;
|
||||
import com.omertron.themoviedbapi.model.person.NewPersonCredits;
|
||||
import com.omertron.themoviedbapi.model.person.Person;
|
||||
import com.omertron.themoviedbapi.model.person.PersonBasic;
|
||||
import com.omertron.themoviedbapi.model.Person;
|
||||
import com.omertron.themoviedbapi.results.TmdbResultsList;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
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;
|
||||
import org.junit.BeforeClass;
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.yamj.api.common.http.DefaultPoolingHttpClient;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author stuart.boston
|
||||
*/
|
||||
public class TmdbPeopleTest extends AbstractTests{
|
||||
public class TmdbPeopleTest extends AbstractTests {
|
||||
|
||||
// Logger
|
||||
private static final Logger LOG = LoggerFactory.getLogger(TmdbGenresTest.class);
|
||||
// API
|
||||
private static TmdbPeople instance;
|
||||
private static final int ID_BRUCE_WILLIS = 62;
|
||||
private static final int ID_SEAN_BEAN = 48;
|
||||
@@ -64,8 +51,8 @@ public class TmdbPeopleTest extends AbstractTests{
|
||||
|
||||
@BeforeClass
|
||||
public static void setUpClass() throws MovieDbException {
|
||||
TestLogger.Configure();
|
||||
instance = new TmdbPeople(getApiKey(),getHttpTools());
|
||||
doConfiguration();
|
||||
instance = new TmdbPeople(getApiKey(), getHttpTools());
|
||||
}
|
||||
|
||||
@AfterClass
|
||||
@@ -117,33 +104,18 @@ public class TmdbPeopleTest extends AbstractTests{
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Test of getPersonChanges method, of class TmdbPeople.
|
||||
*
|
||||
* @throws MovieDbException
|
||||
*/
|
||||
@Ignore("Not ready yet")
|
||||
public void testGetPersonChanges() throws MovieDbException {
|
||||
LOG.info("getPersonChanges");
|
||||
String startDate = "";
|
||||
String endDate = "";
|
||||
instance.getPersonChanges(ID_BRUCE_WILLIS, startDate, endDate);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test of getPersonPopular method, of class TmdbPeople.
|
||||
*
|
||||
* @throws com.omertron.themoviedbapi.MovieDbException
|
||||
*/
|
||||
// @Test
|
||||
@Test
|
||||
public void testGetPersonPopular() throws MovieDbException {
|
||||
LOG.info("getPersonPopular");
|
||||
int page = 0;
|
||||
TmdbResultsList<PersonBasic> result = instance.getPersonPopular(page);
|
||||
TmdbResultsList<Person> result = instance.getPersonPopular(page);
|
||||
assertFalse("No popular people", result.getResults().isEmpty());
|
||||
for (PersonBasic person : result.getResults()) {
|
||||
assertTrue("Missing name", StringUtils.isNotBlank(person.getName()));
|
||||
}
|
||||
fail("The test case is a prototype.");
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -151,7 +123,7 @@ public class TmdbPeopleTest extends AbstractTests{
|
||||
*
|
||||
* @throws com.omertron.themoviedbapi.MovieDbException
|
||||
*/
|
||||
// @Test
|
||||
@Test
|
||||
public void testGetPersonLatest() throws MovieDbException {
|
||||
LOG.info("getPersonLatest");
|
||||
|
||||
@@ -159,57 +131,7 @@ public class TmdbPeopleTest extends AbstractTests{
|
||||
|
||||
assertNotNull("No results found", result);
|
||||
assertTrue("No results found", StringUtils.isNotBlank(result.getName()));
|
||||
}
|
||||
|
||||
/**
|
||||
* Test of getPersonMovieOldCredits method, of class TheMovieDbApi.
|
||||
*
|
||||
* @throws MovieDbException
|
||||
*/
|
||||
@Test
|
||||
public void testGetPersonMovieCredits() throws MovieDbException {
|
||||
LOG.info("getPersonMovieCredits");
|
||||
|
||||
NewPersonCredits result = instance.getPersonMovieCredits(ID_BRUCE_WILLIS, LANGUAGE_DEFAULT);
|
||||
assertEquals("Invalid ID", ID_BRUCE_WILLIS, result.getId());
|
||||
assertFalse("No cast information returned", result.getCast().isEmpty());
|
||||
for(NewCast person:result.getCast()) {
|
||||
LOG.info(person.toString());
|
||||
}
|
||||
|
||||
assertFalse("No crew information returned", result.getCrew().isEmpty());
|
||||
}
|
||||
|
||||
/**
|
||||
* Test of getPersonTvCredits method, of class TmdbPeople.
|
||||
*
|
||||
* @throws com.omertron.themoviedbapi.MovieDbException
|
||||
*/
|
||||
// @Test
|
||||
public void testGetPersonTvCredits() throws MovieDbException {
|
||||
LOG.info("getPersonTvCredits");
|
||||
|
||||
NewPersonCredits result = instance.getPersonTvCredits(ID_DICK_WOLF, LANGUAGE_DEFAULT);
|
||||
assertEquals("Invalid ID", ID_DICK_WOLF, result.getId());
|
||||
assertFalse("No cast information returned", result.getCast().isEmpty());
|
||||
assertFalse("No crew information returned", result.getCrew().isEmpty());
|
||||
}
|
||||
|
||||
/**
|
||||
* Test of getPersonCombinedCredits method, of class TmdbPeople.
|
||||
*
|
||||
* @throws com.omertron.themoviedbapi.MovieDbException
|
||||
*/
|
||||
// @Test
|
||||
public void testGetPersonCombinedCredits() throws MovieDbException {
|
||||
LOG.info("getPersonCombinedCredits");
|
||||
|
||||
NewPersonCredits result = instance.getPersonCombinedCredits(ID_SEAN_BEAN, LANGUAGE_DEFAULT);
|
||||
assertEquals("Invalid ID", ID_SEAN_BEAN, result.getId());
|
||||
assertFalse("No cast information returned", result.getCast().isEmpty());
|
||||
assertFalse("No crew information returned", result.getCrew().isEmpty());
|
||||
|
||||
LOG.info("{}", result.toString());
|
||||
fail("The test case is a prototype.");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -21,28 +21,19 @@ package com.omertron.themoviedbapi.methods;
|
||||
|
||||
import com.omertron.themoviedbapi.AbstractTests;
|
||||
import com.omertron.themoviedbapi.MovieDbException;
|
||||
import com.omertron.themoviedbapi.TestLogger;
|
||||
import static com.omertron.themoviedbapi.TheMovieDbApiTest.getApiKey();
|
||||
import com.omertron.themoviedbapi.model.Review;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.junit.After;
|
||||
import org.junit.AfterClass;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.junit.Assert.fail;
|
||||
import org.junit.Before;
|
||||
import org.junit.BeforeClass;
|
||||
import org.junit.Test;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.yamj.api.common.http.DefaultPoolingHttpClient;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author stuart.boston
|
||||
*/
|
||||
public class TmdbReviewsTest extends AbstractTests{
|
||||
public class TmdbReviewsTest extends AbstractTests {
|
||||
|
||||
// Logger
|
||||
private static final Logger LOG = LoggerFactory.getLogger(TmdbAuthenticationTest.class);
|
||||
// API
|
||||
private static TmdbReviews instance;
|
||||
|
||||
@@ -51,8 +42,8 @@ public class TmdbReviewsTest extends AbstractTests{
|
||||
|
||||
@BeforeClass
|
||||
public static void setUpClass() throws MovieDbException {
|
||||
TestLogger.Configure();
|
||||
instance = new TmdbReviews(getApiKey(),getHttpTools());
|
||||
doConfiguration();
|
||||
instance = new TmdbReviews(getApiKey(), getHttpTools());
|
||||
}
|
||||
|
||||
@AfterClass
|
||||
@@ -75,11 +66,7 @@ public class TmdbReviewsTest extends AbstractTests{
|
||||
@Test
|
||||
public void testGetReview() throws MovieDbException {
|
||||
LOG.info("getReview");
|
||||
String reviewId = "5013bc76760ee372cb00253e";
|
||||
Review result = instance.getReview(reviewId);
|
||||
LOG.info(result.toString());
|
||||
assertTrue("No Author", StringUtils.isNotBlank(result.getAuthor()));
|
||||
assertTrue("No Content", StringUtils.isNotBlank(result.getContent()));
|
||||
fail("The test case is a prototype.");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -21,14 +21,12 @@ package com.omertron.themoviedbapi.methods;
|
||||
|
||||
import com.omertron.themoviedbapi.AbstractTests;
|
||||
import com.omertron.themoviedbapi.MovieDbException;
|
||||
import com.omertron.themoviedbapi.TestLogger;
|
||||
import com.omertron.themoviedbapi.model.Collection;
|
||||
import com.omertron.themoviedbapi.model.Company;
|
||||
import com.omertron.themoviedbapi.model.Keyword;
|
||||
import com.omertron.themoviedbapi.model.MovieDb;
|
||||
import com.omertron.themoviedbapi.model.MovieList;
|
||||
import com.omertron.themoviedbapi.model.person.PersonMovieOld;
|
||||
import com.omertron.themoviedbapi.model.tv.TVSeriesBasic;
|
||||
import com.omertron.themoviedbapi.model.Person;
|
||||
import com.omertron.themoviedbapi.results.TmdbResultsList;
|
||||
import org.junit.AfterClass;
|
||||
import static org.junit.Assert.assertFalse;
|
||||
@@ -51,7 +49,7 @@ public class TmdbSearchTest extends AbstractTests {
|
||||
|
||||
@BeforeClass
|
||||
public static void setUpClass() throws MovieDbException {
|
||||
TestLogger.Configure();
|
||||
doConfiguration();
|
||||
instance = new TmdbSearch(getApiKey(), getHttpTools());
|
||||
}
|
||||
|
||||
@@ -82,18 +80,6 @@ public class TmdbSearchTest extends AbstractTests {
|
||||
assertTrue("Not enough movies found, should be over 15, found " + movieList.getResults().size(), movieList.getResults().size() >= 15);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test of searchTv method, of class TmdbSearch.
|
||||
*
|
||||
* @throws MovieDbException
|
||||
*/
|
||||
@Test
|
||||
public void testSearchTv() throws MovieDbException {
|
||||
LOG.info("searchTv");
|
||||
TmdbResultsList<TVSeriesBasic> results = instance.searchTv("Big Bang Theory", 0, LANGUAGE_DEFAULT, null, 0);
|
||||
assertFalse("No shows found, should be at least 1", results.getResults().isEmpty());
|
||||
}
|
||||
|
||||
/**
|
||||
* Test of searchCollection method, of class TheMovieDbApi.
|
||||
*
|
||||
@@ -119,7 +105,7 @@ public class TmdbSearchTest extends AbstractTests {
|
||||
LOG.info("searchPeople");
|
||||
String personName = "Bruce Willis";
|
||||
boolean includeAdult = false;
|
||||
TmdbResultsList<PersonMovieOld> result = instance.searchPeople(personName, includeAdult, 0);
|
||||
TmdbResultsList<Person> result = instance.searchPeople(personName, includeAdult, 0);
|
||||
assertTrue("Couldn't find the person", result.getResults().size() > 0);
|
||||
}
|
||||
|
||||
|
||||
@@ -21,23 +21,9 @@ package com.omertron.themoviedbapi.methods;
|
||||
|
||||
import com.omertron.themoviedbapi.AbstractTests;
|
||||
import com.omertron.themoviedbapi.MovieDbException;
|
||||
import com.omertron.themoviedbapi.TestLogger;
|
||||
import com.omertron.themoviedbapi.model.Artwork;
|
||||
import com.omertron.themoviedbapi.model.ExternalIds;
|
||||
import com.omertron.themoviedbapi.model.tv.TVCredits;
|
||||
import com.omertron.themoviedbapi.model.tv.TVEpisode;
|
||||
import com.omertron.themoviedbapi.model.tv.TVSeason;
|
||||
import com.omertron.themoviedbapi.model.tv.TVSeries;
|
||||
import com.omertron.themoviedbapi.results.TmdbResultsList;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.junit.AfterClass;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertFalse;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.junit.Assert.fail;
|
||||
import org.junit.BeforeClass;
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
|
||||
/**
|
||||
* Test for the TV Method
|
||||
@@ -56,170 +42,17 @@ public class TmdbTVTest extends AbstractTests {
|
||||
|
||||
@BeforeClass
|
||||
public static void setUpClass() throws MovieDbException {
|
||||
TestLogger.Configure();
|
||||
instance = new TmdbTV(getApiKey(),getHttpTools());
|
||||
doConfiguration();
|
||||
instance = new TmdbTV(getApiKey(), getHttpTools());
|
||||
}
|
||||
|
||||
@AfterClass
|
||||
public static void tearDownClass() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Test of getTv method, of class TV.
|
||||
*
|
||||
* @throws com.omertron.themoviedbapi.MovieDbException
|
||||
*/
|
||||
//@Test
|
||||
public void testGetTv() throws MovieDbException {
|
||||
LOG.info("getTv");
|
||||
TVSeries result = instance.getTv(ID_BIG_BANG_THEORY, LANGUAGE_DEFAULT, null);
|
||||
assertEquals("Wrong title returned", "The Big Bang Theory", result.getName());
|
||||
assertTrue("No seasons returned", result.getNumberSeasons() >= 5);
|
||||
assertTrue("No episodes returned", result.getNumberEpisodes() > 100);
|
||||
assertFalse("No genres returned", result.getGenres().isEmpty());
|
||||
assertFalse("No created by", result.getCreatedBy().isEmpty());
|
||||
}
|
||||
|
||||
/**
|
||||
* Test of getTvCredits method, of class TV.
|
||||
*
|
||||
* @throws com.omertron.themoviedbapi.MovieDbException
|
||||
*/
|
||||
@Test
|
||||
public void testGetTvCredits() throws MovieDbException {
|
||||
LOG.info("getTvCredits");
|
||||
|
||||
TVCredits result = instance.getTvCredits(ID_BIG_BANG_THEORY, LANGUAGE_DEFAULT, null);
|
||||
assertFalse("No cast", result.getCast().isEmpty());
|
||||
assertFalse("No crew", result.getCrew().isEmpty());
|
||||
assertTrue("Guest stars returned", result.getGuestStar().isEmpty());
|
||||
}
|
||||
|
||||
/**
|
||||
* Test of getTvExternalIds method, of class TV.
|
||||
*
|
||||
* @throws com.omertron.themoviedbapi.MovieDbException
|
||||
*/
|
||||
//@Test
|
||||
public void testGetTvExternalIds() throws MovieDbException {
|
||||
LOG.info("getTvExternalIds");
|
||||
ExternalIds result = instance.getTvExternalIds(ID_BIG_BANG_THEORY, LANGUAGE_DEFAULT);
|
||||
assertFalse("No ids found", result.getIds().isEmpty());
|
||||
assertTrue("TMDB Id not found", result.hasId("id"));
|
||||
assertEquals("Wrong id returned", Integer.toString(ID_BIG_BANG_THEORY), result.getId("id"));
|
||||
assertEquals("Wrong TVDB Id returned", "80379", result.getId("tvdb_id"));
|
||||
}
|
||||
|
||||
/**
|
||||
* Test of getTvImages method, of class TV.
|
||||
*
|
||||
* @throws com.omertron.themoviedbapi.MovieDbException
|
||||
*/
|
||||
//@Test
|
||||
public void testGetTvImages() throws MovieDbException {
|
||||
LOG.info("getTvImages");
|
||||
TmdbResultsList<Artwork> result = instance.getTvImages(ID_BIG_BANG_THEORY, LANGUAGE_DEFAULT);
|
||||
assertFalse("No results found", result.getResults().isEmpty());
|
||||
}
|
||||
|
||||
/**
|
||||
* Test of getTvSeason method, of class TV.
|
||||
*
|
||||
* @throws com.omertron.themoviedbapi.MovieDbException
|
||||
*/
|
||||
//@Test
|
||||
public void testGetTvSeason() throws MovieDbException {
|
||||
LOG.info("getTvSeason");
|
||||
|
||||
TVSeason result = instance.getTvSeason(ID_BIG_BANG_THEORY, 1, LANGUAGE_DEFAULT, null);
|
||||
assertFalse("No episodes found for season", result.getEpisodes().isEmpty());
|
||||
assertEquals("Wrong air date", "2007-09-24", result.getAirDate());
|
||||
assertEquals("Wrong season name", "Season 1", result.getName());
|
||||
}
|
||||
|
||||
/**
|
||||
* Test of getTvSeasonExternalIds method, of class TV.
|
||||
*
|
||||
* @throws com.omertron.themoviedbapi.MovieDbException
|
||||
*/
|
||||
//@Test
|
||||
public void testGetTvSeasonExternalIds() throws MovieDbException {
|
||||
LOG.info("getTvSeasonExternalIds");
|
||||
|
||||
ExternalIds result = instance.getTvSeasonExternalIds(ID_BIG_BANG_THEORY, 1, LANGUAGE_DEFAULT);
|
||||
assertFalse("No ids found", result.getIds().isEmpty());
|
||||
assertTrue("TMDB Id not found", result.hasId("id"));
|
||||
assertEquals("Wrong season id returned", "3738", result.getId("id"));
|
||||
assertEquals("Wrong TVDB Id returned", "28047", result.getId("tvdb_id"));
|
||||
}
|
||||
|
||||
/**
|
||||
* Test of getTvSeasonImages method, of class TV.
|
||||
*
|
||||
* @throws com.omertron.themoviedbapi.MovieDbException
|
||||
*/
|
||||
//@Test
|
||||
public void testGetTvSeasonImages() throws MovieDbException {
|
||||
LOG.info("getTvSeasonImages");
|
||||
TmdbResultsList<Artwork> result = instance.getTvSeasonImages(ID_BIG_BANG_THEORY, 1, LANGUAGE_DEFAULT);
|
||||
assertFalse("No results found", result.getResults().isEmpty());
|
||||
}
|
||||
|
||||
/**
|
||||
* Test of getTvEpisode method, of class TV.
|
||||
*
|
||||
* @throws com.omertron.themoviedbapi.MovieDbException
|
||||
*/
|
||||
//@Test
|
||||
public void testGetTvEpisode() throws MovieDbException {
|
||||
LOG.info("getTvEpisode");
|
||||
TVEpisode result = instance.getTvEpisode(ID_BIG_BANG_THEORY, 1, 1, LANGUAGE_DEFAULT, null);
|
||||
assertEquals("Wrong ID", 64766, result.getId());
|
||||
assertEquals("Wrong date", "2007-09-24", result.getAirDate());
|
||||
assertTrue("No overview", StringUtils.isNotBlank(result.getOverview()));
|
||||
}
|
||||
|
||||
/**
|
||||
* Test of getTvEpisodeCredits method, of class TV.
|
||||
*
|
||||
* @throws com.omertron.themoviedbapi.MovieDbException
|
||||
*/
|
||||
@Test
|
||||
public void testGetTvEpisodeCredits() throws MovieDbException {
|
||||
LOG.info("getTvEpisodeCredits");
|
||||
TVCredits result = instance.getTvEpisodeCredits(ID_BIG_BANG_THEORY, 1, 1, LANGUAGE_DEFAULT);
|
||||
assertFalse("No cast", result.getCast().isEmpty());
|
||||
assertFalse("No crew", result.getCrew().isEmpty());
|
||||
assertFalse("No Guest stars returned", result.getGuestStar().isEmpty());
|
||||
}
|
||||
|
||||
/**
|
||||
* Test of getTvEpisodeExternalIds method, of class TV.
|
||||
*
|
||||
* @throws com.omertron.themoviedbapi.MovieDbException
|
||||
*/
|
||||
@Ignore("Find an episode with ids to test this on")
|
||||
public void testGetTvEpisodeExternalIds() throws MovieDbException {
|
||||
LOG.info("getTvEpisodeExternalIds");
|
||||
ExternalIds result = instance.getTvEpisodeExternalIds(ID_BIG_BANG_THEORY, 1, 1, LANGUAGE_DEFAULT);
|
||||
LOG.info("{}", result);
|
||||
assertFalse("No ids found", result.getIds().isEmpty());
|
||||
assertTrue("TMDB Id not found", result.hasId("id"));
|
||||
assertEquals("Wrong season id returned", "3738", result.getId("id"));
|
||||
assertEquals("Wrong TVDB Id returned", "28047", result.getId("tvdb_id"));
|
||||
}
|
||||
|
||||
/**
|
||||
* Test of getTvEpisodeImages method, of class TV.
|
||||
*
|
||||
* @throws com.omertron.themoviedbapi.MovieDbException
|
||||
*/
|
||||
//@Test
|
||||
public void testGetTvEpisodeImages() throws MovieDbException {
|
||||
LOG.info("getTvEpisodeImages");
|
||||
String result = instance.getTvEpisodeImages(ID_BIG_BANG_THEORY, 1, 1, LANGUAGE_DEFAULT);
|
||||
LOG.info("{}", result);
|
||||
fail("Unfinished");
|
||||
fail("The test case is a prototype.");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user