Sonar fixes
This commit is contained in:
@@ -37,7 +37,11 @@ public class PostTools {
|
||||
|
||||
private final Map<String, Object> values = new HashMap<>();
|
||||
|
||||
/**
|
||||
* Construct an empty set of values
|
||||
*/
|
||||
public PostTools() {
|
||||
// Create an empty set of values
|
||||
}
|
||||
|
||||
public PostTools add(PostBody key, Object value) {
|
||||
|
||||
@@ -39,6 +39,7 @@ public class TmdbParameters {
|
||||
* Construct an empty set of parameters
|
||||
*/
|
||||
public TmdbParameters() {
|
||||
// Create an empty set of parameters
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -44,9 +44,9 @@ import org.yamj.api.common.http.SimpleHttpClientBuilder;
|
||||
public class AbstractTests {
|
||||
|
||||
protected static final Logger LOG = LoggerFactory.getLogger(AbstractTests.class);
|
||||
private static final String PROP_FIlENAME = "testing.properties";
|
||||
private static final String PROP_FILENAME = "testing.properties";
|
||||
private static final String FILENAME_EXT = ".bin";
|
||||
private static final Properties props = new Properties();
|
||||
private static final Properties PROPS = new Properties();
|
||||
private static HttpClient httpClient;
|
||||
private static HttpTools httpTools;
|
||||
// Session informaion
|
||||
@@ -57,6 +57,10 @@ public class AbstractTests {
|
||||
protected static final String LANGUAGE_ENGLISH = "en";
|
||||
protected static final String LANGUAGE_RUSSIAN = "ru";
|
||||
|
||||
protected AbstractTests() {
|
||||
throw new UnsupportedOperationException("Utility class");
|
||||
}
|
||||
|
||||
/**
|
||||
* Do the initial configuration for the test cases
|
||||
*
|
||||
@@ -67,21 +71,21 @@ public class AbstractTests {
|
||||
httpClient = new SimpleHttpClientBuilder().build();
|
||||
httpTools = new HttpTools(httpClient);
|
||||
|
||||
if (props.isEmpty()) {
|
||||
File f = new File(PROP_FIlENAME);
|
||||
if (PROPS.isEmpty()) {
|
||||
File f = new File(PROP_FILENAME);
|
||||
if (f.exists()) {
|
||||
LOG.info("Loading properties from '{}'", PROP_FIlENAME);
|
||||
TestLogger.loadProperties(props, f);
|
||||
LOG.info("Loading properties from '{}'", PROP_FILENAME);
|
||||
TestLogger.loadProperties(PROPS, f);
|
||||
} else {
|
||||
LOG.info("Property file '{}' not found, creating dummy file.", PROP_FIlENAME);
|
||||
LOG.info("Property file '{}' not found, creating dummy file.", PROP_FILENAME);
|
||||
|
||||
props.setProperty("API_Key", "INSERT_YOUR_KEY_HERE");
|
||||
props.setProperty("Username", "INSERT_YOUR_USERNAME_HERE");
|
||||
props.setProperty("Password", "INSERT_YOUR_PASSWORD_HERE");
|
||||
props.setProperty("GuestSession", "INSERT_YOUR_GUEST_SESSION_ID_HERE");
|
||||
PROPS.setProperty("API_Key", "INSERT_YOUR_KEY_HERE");
|
||||
PROPS.setProperty("Username", "INSERT_YOUR_USERNAME_HERE");
|
||||
PROPS.setProperty("Password", "INSERT_YOUR_PASSWORD_HERE");
|
||||
PROPS.setProperty("GuestSession", "INSERT_YOUR_GUEST_SESSION_ID_HERE");
|
||||
|
||||
TestLogger.saveProperties(props, f, "Properties file for tests");
|
||||
fail("Failed to get key information from properties file '" + PROP_FIlENAME + "'");
|
||||
TestLogger.saveProperties(PROPS, f, "Properties file for tests");
|
||||
fail("Failed to get key information from properties file '" + PROP_FILENAME + "'");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -225,7 +229,7 @@ public class AbstractTests {
|
||||
* @return
|
||||
*/
|
||||
protected static String getApiKey() {
|
||||
return props.getProperty("API_Key");
|
||||
return PROPS.getProperty("API_Key");
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -234,7 +238,7 @@ public class AbstractTests {
|
||||
* @return
|
||||
*/
|
||||
protected static String getUsername() {
|
||||
return props.getProperty("Username");
|
||||
return PROPS.getProperty("Username");
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -243,7 +247,7 @@ public class AbstractTests {
|
||||
* @return
|
||||
*/
|
||||
protected static String getPassword() {
|
||||
return props.getProperty("Password");
|
||||
return PROPS.getProperty("Password");
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -252,7 +256,7 @@ public class AbstractTests {
|
||||
* @return
|
||||
*/
|
||||
protected static String getGuestSession() {
|
||||
return props.getProperty("GuestSession");
|
||||
return PROPS.getProperty("GuestSession");
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -263,7 +267,7 @@ public class AbstractTests {
|
||||
*/
|
||||
protected static String getProperty(String property) {
|
||||
appendToResponseBuilder(MovieMethod.class);
|
||||
return props.getProperty(property);
|
||||
return PROPS.getProperty(property);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -21,10 +21,7 @@ package com.omertron.themoviedbapi;
|
||||
|
||||
import com.omertron.themoviedbapi.model.movie.MovieInfo;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.junit.After;
|
||||
import org.junit.AfterClass;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import org.junit.Before;
|
||||
import org.junit.BeforeClass;
|
||||
import org.junit.Test;
|
||||
import org.slf4j.Logger;
|
||||
@@ -61,18 +58,6 @@ public class CompareTest {
|
||||
moviedb.setReleaseDate(YEAR_FULL);
|
||||
}
|
||||
|
||||
@AfterClass
|
||||
public static void tearDownClass() throws Exception {
|
||||
}
|
||||
|
||||
@Before
|
||||
public void setUp() throws Exception {
|
||||
}
|
||||
|
||||
@After
|
||||
public void tearDown() throws Exception {
|
||||
}
|
||||
|
||||
/**
|
||||
* Exact match
|
||||
*/
|
||||
|
||||
@@ -45,6 +45,11 @@ import static org.junit.Assert.assertTrue;
|
||||
|
||||
public class TestSuite {
|
||||
|
||||
private static final String MISSING_NAME = ": Missing name";
|
||||
private static final String MISSING_POSTER = ": Missing poster";
|
||||
private static final String MISSING_TITLE = ": Missing title";
|
||||
private static final String MISSING_ID = ": Missing ID";
|
||||
|
||||
private TestSuite() {
|
||||
throw new UnsupportedOperationException("Utility class");
|
||||
}
|
||||
@@ -66,16 +71,16 @@ public class TestSuite {
|
||||
|
||||
public static void test(MovieBasic test) {
|
||||
String message = test.getClass().getSimpleName();
|
||||
assertTrue(message + ": Missing title", isNotBlank(test.getTitle()));
|
||||
assertTrue(message + ": Missing poster", isNotBlank(test.getPosterPath()));
|
||||
assertTrue(message + MISSING_TITLE, isNotBlank(test.getTitle()));
|
||||
assertTrue(message + MISSING_POSTER, isNotBlank(test.getPosterPath()));
|
||||
assertTrue(message + ": Missing release date", isNotBlank(test.getReleaseDate()));
|
||||
}
|
||||
|
||||
public static void test(MovieInfo test) {
|
||||
String message = test.getClass().getSimpleName();
|
||||
assertTrue(message + ": Missing title", isNotBlank(test.getTitle()));
|
||||
assertTrue(message + MISSING_TITLE, isNotBlank(test.getTitle()));
|
||||
assertTrue(message + ": Missing original title", isNotBlank(test.getOriginalTitle()));
|
||||
assertTrue(message + ": Missing poster", isNotBlank(test.getPosterPath()));
|
||||
assertTrue(message + MISSING_POSTER, isNotBlank(test.getPosterPath()));
|
||||
assertTrue(message + ": Missing release date", isNotBlank(test.getReleaseDate()));
|
||||
assertTrue(message + ": Missing backdrop", isNotBlank(test.getBackdropPath()));
|
||||
assertTrue(message + ": Missing poster path", isNotBlank(test.getPosterPath()));
|
||||
@@ -88,20 +93,20 @@ public class TestSuite {
|
||||
|
||||
public static void test(UserList test) {
|
||||
String message = test.getClass().getSimpleName();
|
||||
assertTrue(message + ": Missing ID", isNotBlank(test.getId()));
|
||||
assertTrue(message + MISSING_ID, isNotBlank(test.getId()));
|
||||
assertTrue(message + ": Missing Description", isNotBlank(test.getDescription()));
|
||||
}
|
||||
|
||||
public static void test(TVBasic test) {
|
||||
String message = test.getClass().getSimpleName();
|
||||
assertTrue(message + ": Missing name", isNotBlank(test.getName()));
|
||||
assertTrue(message + ": Missing poster", isNotBlank(test.getPosterPath()));
|
||||
assertTrue(message + MISSING_NAME, isNotBlank(test.getName()));
|
||||
assertTrue(message + MISSING_POSTER, isNotBlank(test.getPosterPath()));
|
||||
assertTrue(message + ": Missing first air date", isNotBlank(test.getFirstAirDate()));
|
||||
}
|
||||
|
||||
public static void test(TVInfo test) {
|
||||
String message = test.getClass().getSimpleName();
|
||||
assertTrue(message + ": Missing ID", test.getId() > 0);
|
||||
assertTrue(message + MISSING_ID, test.getId() > 0);
|
||||
assertFalse(message + ": Missing runtime", test.getEpisodeRunTime().isEmpty());
|
||||
assertFalse(message + ": Missing genres", test.getGenres().isEmpty());
|
||||
assertTrue(message + ": Missing season count", test.getNumberOfSeasons() > 0);
|
||||
@@ -110,8 +115,8 @@ public class TestSuite {
|
||||
|
||||
public static void test(TVEpisodeInfo test) {
|
||||
String message = test.getClass().getSimpleName();
|
||||
assertTrue(message + ": Missing ID", test.getId() > 0);
|
||||
assertTrue(message + ": Missing name", StringUtils.isNotBlank(test.getName()));
|
||||
assertTrue(message + MISSING_ID, test.getId() > 0);
|
||||
assertTrue(message + MISSING_NAME, StringUtils.isNotBlank(test.getName()));
|
||||
assertFalse(message + ": Missing crew", test.getCrew().isEmpty());
|
||||
assertFalse(message + ": Missing guest stars", test.getGuestStars().isEmpty());
|
||||
}
|
||||
@@ -121,7 +126,7 @@ public class TestSuite {
|
||||
assertTrue(message + ": Missing bio", StringUtils.isNotBlank(test.getBiography()));
|
||||
assertTrue(message + ": Missing birthday", StringUtils.isNotBlank(test.getBirthday()));
|
||||
assertTrue(message + ": Missing homepage", StringUtils.isNotBlank(test.getHomepage()));
|
||||
assertTrue(message + ": Missing name", StringUtils.isNotBlank(test.getName()));
|
||||
assertTrue(message + MISSING_NAME, StringUtils.isNotBlank(test.getName()));
|
||||
assertTrue(message + ": Missing birth place", StringUtils.isNotBlank(test.getPlaceOfBirth()));
|
||||
assertTrue(message + ": Missing artwork", StringUtils.isNotBlank(test.getProfilePath()));
|
||||
assertTrue(message + ": Missing bio", test.getPopularity() > 0F);
|
||||
@@ -129,8 +134,8 @@ public class TestSuite {
|
||||
|
||||
public static void test(TVSeasonInfo test) {
|
||||
String message = test.getClass().getSimpleName();
|
||||
assertTrue(message + ": Missing ID", test.getId() > 0);
|
||||
assertTrue(message + ": Missing name", StringUtils.isNotBlank(test.getName()));
|
||||
assertTrue(message + MISSING_ID, test.getId() > 0);
|
||||
assertTrue(message + MISSING_NAME, StringUtils.isNotBlank(test.getName()));
|
||||
assertTrue(message + ": Missing overview", StringUtils.isNotBlank(test.getOverview()));
|
||||
assertTrue(message + ": Missing episodes", test.getEpisodes().size() > 0);
|
||||
}
|
||||
|
||||
@@ -31,12 +31,9 @@ import com.omertron.themoviedbapi.model.movie.MovieBasic;
|
||||
import com.omertron.themoviedbapi.model.tv.TVBasic;
|
||||
import com.omertron.themoviedbapi.results.ResultList;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import org.junit.After;
|
||||
import org.junit.AfterClass;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import org.junit.Before;
|
||||
import org.junit.BeforeClass;
|
||||
import org.junit.Test;
|
||||
|
||||
@@ -46,6 +43,9 @@ import org.junit.Test;
|
||||
*/
|
||||
public class TmdbAccountTest extends AbstractTests {
|
||||
|
||||
private static final String RESULT = "Result: {}";
|
||||
private static final String INCORRECT_STATUS_CODE = "Incorrect status code";
|
||||
|
||||
private static TmdbAccount instance;
|
||||
// Constants
|
||||
private static final int ID_MOVIE_FIGHT_CLUB = 550;
|
||||
@@ -60,18 +60,6 @@ public class TmdbAccountTest extends AbstractTests {
|
||||
instance = new TmdbAccount(getApiKey(), getHttpTools());
|
||||
}
|
||||
|
||||
@AfterClass
|
||||
public static void tearDownClass() {
|
||||
}
|
||||
|
||||
@Before
|
||||
public void setUp() throws MovieDbException {
|
||||
}
|
||||
|
||||
@After
|
||||
public void tearDown() throws MovieDbException {
|
||||
}
|
||||
|
||||
/**
|
||||
* Test of getAccountId method, of class TmdbAccount.
|
||||
*
|
||||
@@ -95,7 +83,7 @@ public class TmdbAccountTest extends AbstractTests {
|
||||
public void testGetUserLists() throws MovieDbException {
|
||||
LOG.info("getUserLists");
|
||||
ResultList<UserList> results = instance.getUserLists(getSessionId(), getAccountId());
|
||||
TestSuite.test(results,"UserLists");
|
||||
TestSuite.test(results, "UserLists");
|
||||
|
||||
for (UserList result : results.getResults()) {
|
||||
TestSuite.test(result);
|
||||
@@ -111,7 +99,7 @@ public class TmdbAccountTest extends AbstractTests {
|
||||
public void testGetFavoriteMovies() throws MovieDbException {
|
||||
LOG.info("getFavoriteMovies");
|
||||
ResultList<MovieBasic> results = instance.getFavoriteMovies(getSessionId(), getAccountId());
|
||||
TestSuite.test(results,"Fav Movies");
|
||||
TestSuite.test(results, "Fav Movies");
|
||||
|
||||
for (MovieBasic result : results.getResults()) {
|
||||
TestSuite.test(result);
|
||||
@@ -127,7 +115,7 @@ public class TmdbAccountTest extends AbstractTests {
|
||||
public void testGetFavoriteTv() throws MovieDbException {
|
||||
LOG.info("getFavoriteTv");
|
||||
ResultList<TVBasic> results = instance.getFavoriteTv(getSessionId(), getAccountId());
|
||||
TestSuite.test(results,"Fav TV");
|
||||
TestSuite.test(results, "Fav TV");
|
||||
|
||||
for (TVBasic result : results.getResults()) {
|
||||
TestSuite.test(result);
|
||||
@@ -145,23 +133,23 @@ public class TmdbAccountTest extends AbstractTests {
|
||||
|
||||
// Add a movie as a favourite
|
||||
StatusCode result = instance.modifyFavoriteStatus(getSessionId(), getAccountId(), MediaType.MOVIE, ID_MOVIE_FIGHT_CLUB, true);
|
||||
LOG.info("Result: {}", result);
|
||||
assertTrue("Incorrect status code", result.getCode() == 1 || result.getCode() == 12);
|
||||
LOG.info(RESULT, result);
|
||||
assertTrue(INCORRECT_STATUS_CODE, result.getCode() == 1 || result.getCode() == 12);
|
||||
|
||||
// Remove a movie as a favourite
|
||||
result = instance.modifyFavoriteStatus(getSessionId(), getAccountId(), MediaType.MOVIE, ID_MOVIE_FIGHT_CLUB, false);
|
||||
LOG.info("Result: {}", result);
|
||||
assertTrue("Incorrect status code", result.getCode() == 13);
|
||||
LOG.info(RESULT, result);
|
||||
assertTrue(INCORRECT_STATUS_CODE, result.getCode() == 13);
|
||||
|
||||
// Add a TV Show as a favourite
|
||||
result = instance.modifyFavoriteStatus(getSessionId(), getAccountId(), MediaType.TV, ID_TV_WALKING_DEAD, true);
|
||||
LOG.info("Result: {}", result);
|
||||
assertTrue("Incorrect status code", result.getCode() == 1 || result.getCode() == 12);
|
||||
LOG.info(RESULT, result);
|
||||
assertTrue(INCORRECT_STATUS_CODE, result.getCode() == 1 || result.getCode() == 12);
|
||||
|
||||
// Remove a TV Show as a favourite
|
||||
result = instance.modifyFavoriteStatus(getSessionId(), getAccountId(), MediaType.TV, ID_TV_WALKING_DEAD, false);
|
||||
LOG.info("Result: {}", result);
|
||||
assertTrue("Incorrect status code", result.getCode() == 13);
|
||||
LOG.info(RESULT, result);
|
||||
assertTrue(INCORRECT_STATUS_CODE, result.getCode() == 13);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -173,7 +161,7 @@ public class TmdbAccountTest extends AbstractTests {
|
||||
public void testGetRatedMovies() throws MovieDbException {
|
||||
LOG.info("getRatedMovies");
|
||||
ResultList<MovieBasic> results = instance.getRatedMovies(getSessionId(), getAccountId(), null, null, null);
|
||||
TestSuite.test(results,"Rated Movies");
|
||||
TestSuite.test(results, "Rated Movies");
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -185,7 +173,7 @@ public class TmdbAccountTest extends AbstractTests {
|
||||
public void testGetRatedTV() throws MovieDbException {
|
||||
LOG.info("getRatedTV");
|
||||
ResultList<TVBasic> results = instance.getRatedTV(getSessionId(), getAccountId(), null, null, null);
|
||||
TestSuite.test(results,"Rated TV");
|
||||
TestSuite.test(results, "Rated TV");
|
||||
for (TVBasic result : results.getResults()) {
|
||||
TestSuite.test(result);
|
||||
}
|
||||
@@ -200,7 +188,7 @@ public class TmdbAccountTest extends AbstractTests {
|
||||
public void testGetWatchListMovie() throws MovieDbException {
|
||||
LOG.info("getWatchListMovie");
|
||||
ResultList<MovieBasic> results = instance.getWatchListMovie(getSessionId(), getAccountId(), null, null, null);
|
||||
TestSuite.test(results,"Watch List Movie");
|
||||
TestSuite.test(results, "Watch List Movie");
|
||||
for (MovieBasic result : results.getResults()) {
|
||||
TestSuite.test(result);
|
||||
}
|
||||
@@ -215,7 +203,7 @@ public class TmdbAccountTest extends AbstractTests {
|
||||
public void testGetWatchListTV() throws MovieDbException {
|
||||
LOG.info("getWatchListTV");
|
||||
ResultList<TVBasic> results = instance.getWatchListTV(getSessionId(), getAccountId(), null, null, null);
|
||||
TestSuite.test(results,"Watch List TV");
|
||||
TestSuite.test(results, "Watch List TV");
|
||||
for (TVBasic result : results.getResults()) {
|
||||
TestSuite.test(result);
|
||||
}
|
||||
@@ -232,23 +220,23 @@ public class TmdbAccountTest extends AbstractTests {
|
||||
|
||||
// Add a movie to the watch list
|
||||
StatusCode result = instance.modifyWatchList(getSessionId(), getAccountId(), MediaType.MOVIE, ID_MOVIE_FIGHT_CLUB, true);
|
||||
LOG.info("Result: {}", result);
|
||||
assertTrue("Incorrect status code", result.getCode() == 1 || result.getCode() == 12);
|
||||
LOG.info(RESULT, result);
|
||||
assertTrue(INCORRECT_STATUS_CODE, result.getCode() == 1 || result.getCode() == 12);
|
||||
|
||||
// Remove a movie from the watch list
|
||||
result = instance.modifyWatchList(getSessionId(), getAccountId(), MediaType.MOVIE, ID_MOVIE_FIGHT_CLUB, false);
|
||||
LOG.info("Result: {}", result);
|
||||
assertTrue("Incorrect status code", result.getCode() == 13);
|
||||
LOG.info(RESULT, result);
|
||||
assertTrue(INCORRECT_STATUS_CODE, result.getCode() == 13);
|
||||
|
||||
// Add a TV Show to the watch list
|
||||
result = instance.modifyWatchList(getSessionId(), getAccountId(), MediaType.TV, ID_TV_WALKING_DEAD, true);
|
||||
LOG.info("Result: {}", result);
|
||||
assertTrue("Incorrect status code", result.getCode() == 1 || result.getCode() == 12);
|
||||
LOG.info(RESULT, result);
|
||||
assertTrue(INCORRECT_STATUS_CODE, result.getCode() == 1 || result.getCode() == 12);
|
||||
|
||||
// Remove a TV Show from the watch list
|
||||
result = instance.modifyWatchList(getSessionId(), getAccountId(), MediaType.TV, ID_TV_WALKING_DEAD, false);
|
||||
LOG.info("Result: {}", result);
|
||||
assertTrue("Incorrect status code", result.getCode() == 13);
|
||||
LOG.info(RESULT, result);
|
||||
assertTrue(INCORRECT_STATUS_CODE, result.getCode() == 13);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -284,7 +272,7 @@ public class TmdbAccountTest extends AbstractTests {
|
||||
result = instance.getGuestRatedMovies(guestSession, language, page, sortBy);
|
||||
}
|
||||
|
||||
TestSuite.test(result,"Guest Reated Movies");
|
||||
TestSuite.test(result, "Guest Reated Movies");
|
||||
}
|
||||
|
||||
private void postGuestRating(String guestSessionId, int movieId) throws MovieDbException {
|
||||
|
||||
@@ -24,12 +24,9 @@ import com.omertron.themoviedbapi.MovieDbException;
|
||||
import com.omertron.themoviedbapi.model.authentication.TokenAuthorisation;
|
||||
import com.omertron.themoviedbapi.model.authentication.TokenSession;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.junit.After;
|
||||
import org.junit.AfterClass;
|
||||
import static org.junit.Assert.assertFalse;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import org.junit.Before;
|
||||
import org.junit.BeforeClass;
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
@@ -51,18 +48,6 @@ public class TmdbAuthenticationTest extends AbstractTests {
|
||||
instance = new TmdbAuthentication(getApiKey(), getHttpTools());
|
||||
}
|
||||
|
||||
@AfterClass
|
||||
public static void tearDownClass() {
|
||||
}
|
||||
|
||||
@Before
|
||||
public void setUp() throws Exception {
|
||||
}
|
||||
|
||||
@After
|
||||
public void tearDown() throws Exception {
|
||||
}
|
||||
|
||||
/**
|
||||
* Test of getAuthorisationToken method, of class TmdbAuthentication.
|
||||
*
|
||||
|
||||
@@ -25,7 +25,6 @@ import com.omertron.themoviedbapi.model.Certification;
|
||||
import com.omertron.themoviedbapi.results.ResultsMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import org.junit.AfterClass;
|
||||
import static org.junit.Assert.assertFalse;
|
||||
import org.junit.BeforeClass;
|
||||
import org.junit.Test;
|
||||
@@ -48,10 +47,6 @@ public class TmdbCertificationsTest extends AbstractTests {
|
||||
instance = new TmdbCertifications(getApiKey(), getHttpTools());
|
||||
}
|
||||
|
||||
@AfterClass
|
||||
public static void tearDownClass() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Test of getMoviesCertification method, of class TmdbCertifications.
|
||||
*
|
||||
|
||||
@@ -25,7 +25,6 @@ import com.omertron.themoviedbapi.TestSuite;
|
||||
import com.omertron.themoviedbapi.model.change.ChangeListItem;
|
||||
import com.omertron.themoviedbapi.results.ResultList;
|
||||
import com.omertron.themoviedbapi.tools.MethodBase;
|
||||
import org.junit.AfterClass;
|
||||
import org.junit.BeforeClass;
|
||||
import org.junit.Test;
|
||||
|
||||
@@ -46,10 +45,6 @@ public class TmdbChangesTest extends AbstractTests {
|
||||
instance = new TmdbChanges(getApiKey(), getHttpTools());
|
||||
}
|
||||
|
||||
@AfterClass
|
||||
public static void tearDownClass() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Test of getChangeList(MOVIE) method, of class TmdbChanges.
|
||||
*
|
||||
|
||||
@@ -25,7 +25,6 @@ import com.omertron.themoviedbapi.TestSuite;
|
||||
import com.omertron.themoviedbapi.model.artwork.Artwork;
|
||||
import com.omertron.themoviedbapi.model.collection.CollectionInfo;
|
||||
import com.omertron.themoviedbapi.results.ResultList;
|
||||
import org.junit.AfterClass;
|
||||
import static org.junit.Assert.assertFalse;
|
||||
import org.junit.BeforeClass;
|
||||
import org.junit.Test;
|
||||
@@ -48,10 +47,6 @@ public class TmdbCollectionsTest extends AbstractTests {
|
||||
instance = new TmdbCollections(getApiKey(), getHttpTools());
|
||||
}
|
||||
|
||||
@AfterClass
|
||||
public static void tearDownClass() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Test of getCollectionInfo method, of class TheMovieDbApi.
|
||||
*
|
||||
@@ -74,7 +69,7 @@ public class TmdbCollectionsTest extends AbstractTests {
|
||||
public void testGetCollectionImages() throws MovieDbException {
|
||||
LOG.info("getCollectionImages");
|
||||
ResultList<Artwork> result = instance.getCollectionImages(ID_COLLECTION_STAR_WARS, LANGUAGE_DEFAULT);
|
||||
TestSuite.test(result,"Collection Images");
|
||||
TestSuite.test(result, "Collection Images");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -25,11 +25,8 @@ import com.omertron.themoviedbapi.TestSuite;
|
||||
import com.omertron.themoviedbapi.model.company.Company;
|
||||
import com.omertron.themoviedbapi.model.movie.MovieBasic;
|
||||
import com.omertron.themoviedbapi.results.ResultList;
|
||||
import org.junit.After;
|
||||
import org.junit.AfterClass;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import org.junit.Before;
|
||||
import org.junit.BeforeClass;
|
||||
import org.junit.Test;
|
||||
|
||||
@@ -51,18 +48,6 @@ public class TmdbCompaniesTest extends AbstractTests {
|
||||
instance = new TmdbCompanies(getApiKey(), getHttpTools());
|
||||
}
|
||||
|
||||
@AfterClass
|
||||
public static void tearDownClass() {
|
||||
}
|
||||
|
||||
@Before
|
||||
public void setUp() {
|
||||
}
|
||||
|
||||
@After
|
||||
public void tearDown() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Test of getCompanyInfo method, of class TheMovieDbApi.
|
||||
*
|
||||
@@ -85,6 +70,6 @@ public class TmdbCompaniesTest extends AbstractTests {
|
||||
public void testGetCompanyMovies() throws MovieDbException {
|
||||
LOG.info("getCompanyMovies");
|
||||
ResultList<MovieBasic> result = instance.getCompanyMovies(ID_COMPANY, LANGUAGE_DEFAULT, 0);
|
||||
TestSuite.test(result,"Company Movies");
|
||||
TestSuite.test(result, "Company Movies");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,12 +28,9 @@ import com.omertron.themoviedbapi.results.ResultList;
|
||||
import com.omertron.themoviedbapi.results.ResultsMap;
|
||||
import java.util.List;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.junit.After;
|
||||
import org.junit.AfterClass;
|
||||
import static org.junit.Assert.assertFalse;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import org.junit.Before;
|
||||
import org.junit.BeforeClass;
|
||||
import org.junit.Test;
|
||||
|
||||
@@ -54,18 +51,6 @@ public class TmdbConfigurationTest extends AbstractTests {
|
||||
instance = new TmdbConfiguration(getApiKey(), getHttpTools());
|
||||
}
|
||||
|
||||
@AfterClass
|
||||
public static void tearDownClass() {
|
||||
}
|
||||
|
||||
@Before
|
||||
public void setUp() {
|
||||
}
|
||||
|
||||
@After
|
||||
public void tearDown() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Test of getConfig method, of class TmdbConfiguration.
|
||||
*
|
||||
@@ -121,8 +106,8 @@ public class TmdbConfigurationTest extends AbstractTests {
|
||||
ResultsMap<String, List<String>> result = instance.getTimezones();
|
||||
assertNotNull("Null results", result);
|
||||
assertFalse("Empty results", result.isEmpty());
|
||||
assertTrue("No US TZ",result.containsKey("US"));
|
||||
assertTrue("No GB TZ",result.containsKey("GB"));
|
||||
assertTrue("No US TZ", result.containsKey("US"));
|
||||
assertTrue("No GB TZ", result.containsKey("GB"));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -22,11 +22,8 @@ package com.omertron.themoviedbapi.methods;
|
||||
import com.omertron.themoviedbapi.AbstractTests;
|
||||
import com.omertron.themoviedbapi.MovieDbException;
|
||||
import com.omertron.themoviedbapi.model.person.CreditInfo;
|
||||
import org.junit.After;
|
||||
import org.junit.AfterClass;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertFalse;
|
||||
import org.junit.Before;
|
||||
import org.junit.BeforeClass;
|
||||
import org.junit.Test;
|
||||
|
||||
@@ -47,18 +44,6 @@ public class TmdbCreditsTest extends AbstractTests {
|
||||
instance = new TmdbCredits(getApiKey(), getHttpTools());
|
||||
}
|
||||
|
||||
@AfterClass
|
||||
public static void tearDownClass() {
|
||||
}
|
||||
|
||||
@Before
|
||||
public void setUp() {
|
||||
}
|
||||
|
||||
@After
|
||||
public void tearDown() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Test of getCreditInfo method, of class TmdbCredits.
|
||||
*
|
||||
|
||||
@@ -26,9 +26,6 @@ import com.omertron.themoviedbapi.model.discover.Discover;
|
||||
import com.omertron.themoviedbapi.model.movie.MovieBasic;
|
||||
import com.omertron.themoviedbapi.model.tv.TVBasic;
|
||||
import com.omertron.themoviedbapi.results.ResultList;
|
||||
import org.junit.After;
|
||||
import org.junit.AfterClass;
|
||||
import org.junit.Before;
|
||||
import org.junit.BeforeClass;
|
||||
import org.junit.Test;
|
||||
|
||||
@@ -49,18 +46,6 @@ public class TmdbDiscoverTest extends AbstractTests {
|
||||
instance = new TmdbDiscover(getApiKey(), getHttpTools());
|
||||
}
|
||||
|
||||
@AfterClass
|
||||
public static void tearDownClass() {
|
||||
}
|
||||
|
||||
@Before
|
||||
public void setUp() {
|
||||
}
|
||||
|
||||
@After
|
||||
public void tearDown() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Test of getDiscoverMovie method, of class TmdbDiscover.
|
||||
*
|
||||
|
||||
@@ -37,13 +37,10 @@ import com.omertron.themoviedbapi.model.tv.TVEpisodeInfo;
|
||||
import com.omertron.themoviedbapi.results.ResultList;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
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 org.junit.Before;
|
||||
import org.junit.BeforeClass;
|
||||
import org.junit.Test;
|
||||
|
||||
@@ -55,6 +52,7 @@ public class TmdbEpisodesTest extends AbstractTests {
|
||||
|
||||
private static TmdbEpisodes instance;
|
||||
private static final List<TestID> TV_IDS = new ArrayList<>();
|
||||
private static final String TESTING = "Testing: {}";
|
||||
|
||||
public TmdbEpisodesTest() {
|
||||
}
|
||||
@@ -69,18 +67,6 @@ public class TmdbEpisodesTest extends AbstractTests {
|
||||
TV_IDS.add(new TestID("The Big Bang Theory", "tt0775431", 1418, "Kaley Cuoco"));
|
||||
}
|
||||
|
||||
@AfterClass
|
||||
public static void tearDownClass() {
|
||||
}
|
||||
|
||||
@Before
|
||||
public void setUp() {
|
||||
}
|
||||
|
||||
@After
|
||||
public void tearDown() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Test of getEpisodeInfo method, of class TmdbEpisodes.
|
||||
*
|
||||
@@ -96,7 +82,7 @@ public class TmdbEpisodesTest extends AbstractTests {
|
||||
String appendToResponse = appendToResponseBuilder(TVEpisodeMethod.class);
|
||||
|
||||
for (TestID test : TV_IDS) {
|
||||
LOG.info("Testing: {}", test);
|
||||
LOG.info(TESTING, test);
|
||||
TVEpisodeInfo result = instance.getEpisodeInfo(test.getTmdb(), seasonNumber, episodeNumber, language, appendToResponse);
|
||||
TestSuite.test(result);
|
||||
TestSuite.testATR(result, TVEpisodeMethod.class, null);
|
||||
@@ -127,7 +113,7 @@ public class TmdbEpisodesTest extends AbstractTests {
|
||||
int episodeNumber = 1;
|
||||
|
||||
for (TestID test : TV_IDS) {
|
||||
LOG.info("Testing: {}", test);
|
||||
LOG.info(TESTING, test);
|
||||
MediaState result = instance.getEpisodeAccountState(test.getTmdb(), seasonNumber, episodeNumber, getSessionId());
|
||||
assertNotNull("Null result", result);
|
||||
assertTrue("Invalid rating", result.getRated() > -2f);
|
||||
@@ -147,7 +133,7 @@ public class TmdbEpisodesTest extends AbstractTests {
|
||||
int episodeNumber = 1;
|
||||
|
||||
for (TestID test : TV_IDS) {
|
||||
LOG.info("Testing: {}", test);
|
||||
LOG.info(TESTING, test);
|
||||
MediaCreditList result = instance.getEpisodeCredits(test.getTmdb(), seasonNumber, episodeNumber);
|
||||
assertNotNull(result);
|
||||
assertFalse(result.getCast().isEmpty());
|
||||
@@ -180,7 +166,7 @@ public class TmdbEpisodesTest extends AbstractTests {
|
||||
String language = LANGUAGE_DEFAULT;
|
||||
|
||||
for (TestID test : TV_IDS) {
|
||||
LOG.info("Testing: {}", test);
|
||||
LOG.info(TESTING, test);
|
||||
ExternalID result = instance.getEpisodeExternalID(test.getTmdb(), seasonNumber, episodeNumber, language);
|
||||
assertEquals("Wrong IMDB ID", test.getImdb(), result.getImdbId());
|
||||
}
|
||||
@@ -199,7 +185,7 @@ public class TmdbEpisodesTest extends AbstractTests {
|
||||
int episodeNumber = 1;
|
||||
|
||||
for (TestID test : TV_IDS) {
|
||||
LOG.info("Testing: {}", test);
|
||||
LOG.info(TESTING, test);
|
||||
ArtworkResults results = new ArtworkResults();
|
||||
ResultList<Artwork> result = instance.getEpisodeImages(test.getTmdb(), seasonNumber, episodeNumber);
|
||||
assertFalse("No artwork", result.isEmpty());
|
||||
@@ -227,7 +213,7 @@ public class TmdbEpisodesTest extends AbstractTests {
|
||||
String guestSessionID = null;
|
||||
|
||||
for (TestID test : TV_IDS) {
|
||||
LOG.info("Testing: {}", test);
|
||||
LOG.info(TESTING, test);
|
||||
int rating = TestSuite.randomRating();
|
||||
StatusCode result = instance.postEpisodeRating(test.getTmdb(), seasonNumber, episodeNumber, rating, getSessionId(), guestSessionID);
|
||||
assertEquals("failed to post rating", 12, result.getCode());
|
||||
|
||||
@@ -28,9 +28,6 @@ import com.omertron.themoviedbapi.model.FindResults;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import org.junit.After;
|
||||
import org.junit.AfterClass;
|
||||
import org.junit.Before;
|
||||
import org.junit.BeforeClass;
|
||||
import org.junit.Test;
|
||||
|
||||
@@ -45,6 +42,7 @@ public class TmdbFindTest extends AbstractTests {
|
||||
private static final List<TestID> PERSON_IDS = new ArrayList<>();
|
||||
private static final List<TestID> FILM_IDS = new ArrayList<>();
|
||||
private static final List<TestID> TV_IDS = new ArrayList<>();
|
||||
private static final String TESTING = "Testing {}";
|
||||
|
||||
public TmdbFindTest() {
|
||||
}
|
||||
@@ -64,18 +62,6 @@ public class TmdbFindTest extends AbstractTests {
|
||||
TV_IDS.add(new TestID("Supernatural", "tt0460681", 1622));
|
||||
}
|
||||
|
||||
@AfterClass
|
||||
public static void tearDownClass() {
|
||||
}
|
||||
|
||||
@Before
|
||||
public void setUp() {
|
||||
}
|
||||
|
||||
@After
|
||||
public void tearDown() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Test of Find Movie
|
||||
*
|
||||
@@ -87,7 +73,7 @@ public class TmdbFindTest extends AbstractTests {
|
||||
FindResults result;
|
||||
|
||||
for (TestID test : FILM_IDS) {
|
||||
LOG.info("Testing {}", test);
|
||||
LOG.info(TESTING, test);
|
||||
result = instance.find(test.getImdb(), ExternalSource.IMDB_ID, LANGUAGE_DEFAULT);
|
||||
TestSuite.test(result.getMovieResults(), "Movies IMDB");
|
||||
TestSuite.testId(result.getMovieResults(), test.getTmdb(), "Movie");
|
||||
@@ -106,7 +92,7 @@ public class TmdbFindTest extends AbstractTests {
|
||||
FindResults result;
|
||||
|
||||
for (TestID test : PERSON_IDS) {
|
||||
LOG.info("Testing {}", test);
|
||||
LOG.info(TESTING, test);
|
||||
result = instance.find(test.getImdb(), ExternalSource.IMDB_ID, LANGUAGE_DEFAULT);
|
||||
TestSuite.test(result.getPersonResults(), "Person IMDB");
|
||||
TestSuite.testId(result.getPersonResults(), test.getTmdb(), "Person");
|
||||
@@ -124,7 +110,7 @@ public class TmdbFindTest extends AbstractTests {
|
||||
FindResults result;
|
||||
|
||||
for (TestID test : TV_IDS) {
|
||||
LOG.info("Testing {}", test);
|
||||
LOG.info(TESTING, test);
|
||||
result = instance.find(test.getImdb(), ExternalSource.IMDB_ID, LANGUAGE_DEFAULT);
|
||||
TestSuite.test(result.getTvResults(), "TV IMDB");
|
||||
TestSuite.testId(result.getTvResults(), test.getTmdb(), "TV");
|
||||
|
||||
@@ -24,11 +24,8 @@ import com.omertron.themoviedbapi.MovieDbException;
|
||||
import com.omertron.themoviedbapi.model.Genre;
|
||||
import com.omertron.themoviedbapi.model.movie.MovieBasic;
|
||||
import com.omertron.themoviedbapi.results.ResultList;
|
||||
import org.junit.After;
|
||||
import org.junit.AfterClass;
|
||||
import static org.junit.Assert.assertFalse;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
import org.junit.Before;
|
||||
import org.junit.BeforeClass;
|
||||
import org.junit.Test;
|
||||
|
||||
@@ -39,6 +36,8 @@ import org.junit.Test;
|
||||
public class TmdbGenresTest extends AbstractTests {
|
||||
|
||||
private static TmdbGenres instance;
|
||||
private static final String LIST_IS_EMPTY = "List is empty";
|
||||
private static final String LIST_IS_NULL = "List is null";
|
||||
private static final int ID_GENRE_ACTION = 28;
|
||||
|
||||
public TmdbGenresTest() {
|
||||
@@ -50,18 +49,6 @@ public class TmdbGenresTest extends AbstractTests {
|
||||
instance = new TmdbGenres(getApiKey(), getHttpTools());
|
||||
}
|
||||
|
||||
@AfterClass
|
||||
public static void tearDownClass() {
|
||||
}
|
||||
|
||||
@Before
|
||||
public void setUp() {
|
||||
}
|
||||
|
||||
@After
|
||||
public void tearDown() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Test of getGenreMovieList method, of class TmdbGenres.
|
||||
*
|
||||
@@ -71,8 +58,8 @@ public class TmdbGenresTest extends AbstractTests {
|
||||
public void testGetGenreMovieList() throws MovieDbException {
|
||||
LOG.info("getGenreMovieList");
|
||||
ResultList<Genre> result = instance.getGenreMovieList(LANGUAGE_DEFAULT);
|
||||
assertNotNull("List is null", result.getResults());
|
||||
assertFalse("List is empty", result.getResults().isEmpty());
|
||||
assertNotNull(LIST_IS_NULL, result.getResults());
|
||||
assertFalse(LIST_IS_EMPTY, result.getResults().isEmpty());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -84,8 +71,8 @@ public class TmdbGenresTest extends AbstractTests {
|
||||
public void testGetGenreTVList() throws MovieDbException {
|
||||
LOG.info("getGenreTVList");
|
||||
ResultList<Genre> result = instance.getGenreTVList(LANGUAGE_DEFAULT);
|
||||
assertNotNull("List is null", result.getResults());
|
||||
assertFalse("List is empty", result.getResults().isEmpty());
|
||||
assertNotNull(LIST_IS_NULL, result.getResults());
|
||||
assertFalse(LIST_IS_EMPTY, result.getResults().isEmpty());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -100,8 +87,8 @@ public class TmdbGenresTest extends AbstractTests {
|
||||
Boolean includeAllMovies = null;
|
||||
Boolean includeAdult = null;
|
||||
ResultList<MovieBasic> result = instance.getGenreMovies(ID_GENRE_ACTION, LANGUAGE_DEFAULT, page, includeAllMovies, includeAdult);
|
||||
assertNotNull("List is null", result);
|
||||
assertFalse("List is empty", result.isEmpty());
|
||||
assertNotNull(LIST_IS_NULL, result);
|
||||
assertFalse(LIST_IS_EMPTY, result.isEmpty());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -25,10 +25,7 @@ import com.omertron.themoviedbapi.TestSuite;
|
||||
import com.omertron.themoviedbapi.model.keyword.Keyword;
|
||||
import com.omertron.themoviedbapi.model.movie.MovieBasic;
|
||||
import com.omertron.themoviedbapi.results.ResultList;
|
||||
import org.junit.After;
|
||||
import org.junit.AfterClass;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import org.junit.Before;
|
||||
import org.junit.BeforeClass;
|
||||
import org.junit.Test;
|
||||
|
||||
@@ -50,18 +47,6 @@ public class TmdbKeywordsTest extends AbstractTests {
|
||||
tmdb = new TmdbKeywords(getApiKey(), getHttpTools());
|
||||
}
|
||||
|
||||
@AfterClass
|
||||
public static void tearDownClass() {
|
||||
}
|
||||
|
||||
@Before
|
||||
public void setUp() {
|
||||
}
|
||||
|
||||
@After
|
||||
public void tearDown() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Test of getKeyword method, of class TheMovieDbApi.
|
||||
*
|
||||
|
||||
@@ -25,12 +25,9 @@ import com.omertron.themoviedbapi.model.StatusCode;
|
||||
import com.omertron.themoviedbapi.model.list.ListItem;
|
||||
import java.util.Random;
|
||||
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.assertTrue;
|
||||
import org.junit.Before;
|
||||
import org.junit.BeforeClass;
|
||||
import org.junit.Rule;
|
||||
import org.junit.Test;
|
||||
@@ -39,6 +36,8 @@ import org.junit.rules.ExpectedException;
|
||||
public class TmdbListsTest extends AbstractTests {
|
||||
|
||||
private static TmdbLists instance;
|
||||
private static final String RESULT = "Result: {}";
|
||||
private static final String INVALID_RESPONSE = "Invalid response: ";
|
||||
private static final int ID_JUPITER_ASCENDING = 76757;
|
||||
private static final int ID_BIG_HERO_6 = 177572;
|
||||
// Status codes
|
||||
@@ -57,18 +56,6 @@ public class TmdbListsTest extends AbstractTests {
|
||||
instance = new TmdbLists(getApiKey(), getHttpTools());
|
||||
}
|
||||
|
||||
@AfterClass
|
||||
public static void tearDownClass() {
|
||||
}
|
||||
|
||||
@Before
|
||||
public void setUp() {
|
||||
}
|
||||
|
||||
@After
|
||||
public void tearDown() {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSuite() throws MovieDbException {
|
||||
// Test the list creation
|
||||
@@ -144,12 +131,12 @@ public class TmdbListsTest extends AbstractTests {
|
||||
private void testDeleteList(String listId) throws MovieDbException {
|
||||
LOG.info("deleteList");
|
||||
StatusCode result = instance.deleteList(getSessionId(), listId);
|
||||
LOG.info("Result: {}", result);
|
||||
LOG.info(RESULT, result);
|
||||
|
||||
// We expect there to be an exception thrown here
|
||||
exception.expect(MovieDbException.class);
|
||||
ListItem result2 = instance.getList(listId);
|
||||
LOG.info("Result: {}", result2);
|
||||
LOG.info(RESULT, result2);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -160,7 +147,7 @@ public class TmdbListsTest extends AbstractTests {
|
||||
private void testAddItem(String listId, int mediaId) throws MovieDbException {
|
||||
LOG.info("addItem");
|
||||
StatusCode result = instance.addItem(getSessionId(), listId, mediaId);
|
||||
assertEquals("Invalid response: " + result.toString(), SC_SUCCESS_UPD, result.getCode());
|
||||
assertEquals(INVALID_RESPONSE + result.toString(), SC_SUCCESS_UPD, result.getCode());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -171,7 +158,7 @@ public class TmdbListsTest extends AbstractTests {
|
||||
private void testRemoveItem(String listId, int mediaId) throws MovieDbException {
|
||||
LOG.info("removeItem");
|
||||
StatusCode result = instance.removeItem(getSessionId(), listId, mediaId);
|
||||
assertEquals("Invalid response: " + result.toString(), SC_SUCCESS_DEL, result.getCode());
|
||||
assertEquals(INVALID_RESPONSE + result.toString(), SC_SUCCESS_DEL, result.getCode());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -182,7 +169,7 @@ public class TmdbListsTest extends AbstractTests {
|
||||
private void testClear(String listId) throws MovieDbException {
|
||||
LOG.info("clear");
|
||||
StatusCode result = instance.clear(getSessionId(), listId, true);
|
||||
assertEquals("Invalid response: " + result.toString(), SC_SUCCESS_UPD, result.getCode());
|
||||
assertEquals(INVALID_RESPONSE + result.toString(), SC_SUCCESS_UPD, result.getCode());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -64,6 +64,7 @@ public class TmdbMoviesTest extends AbstractTests {
|
||||
|
||||
private static TmdbMovies instance;
|
||||
private static final List<TestID> FILM_IDS = new ArrayList<>();
|
||||
private static final String WRONG_TITLE = "Wrong title";
|
||||
|
||||
public TmdbMoviesTest() {
|
||||
}
|
||||
@@ -99,7 +100,7 @@ public class TmdbMoviesTest extends AbstractTests {
|
||||
|
||||
MovieInfo result = instance.getMovieInfo(test.getTmdb(), language, appendToResponse);
|
||||
assertEquals("Wrong IMDB ID", test.getImdb(), result.getImdbID());
|
||||
assertEquals("Wrong title", test.getName(), result.getTitle());
|
||||
assertEquals(WRONG_TITLE, test.getName(), result.getTitle());
|
||||
TestSuite.test(result);
|
||||
TestSuite.testATR(result, MovieMethod.class, MovieMethod.CHANGES);
|
||||
TestSuite.test(result.getAlternativeTitles(), "Alt titles");
|
||||
@@ -132,7 +133,7 @@ public class TmdbMoviesTest extends AbstractTests {
|
||||
for (TestID test : FILM_IDS) {
|
||||
MovieInfo result = instance.getMovieInfo(test.getTmdb(), language, appendToResponse);
|
||||
assertEquals("Wrong IMDB ID", test.getImdb(), result.getImdbID());
|
||||
assertEquals("Wrong title", test.getName(), result.getTitle());
|
||||
assertEquals(WRONG_TITLE, test.getName(), result.getTitle());
|
||||
TestSuite.test(result);
|
||||
}
|
||||
}
|
||||
@@ -151,7 +152,7 @@ public class TmdbMoviesTest extends AbstractTests {
|
||||
for (TestID test : FILM_IDS) {
|
||||
MovieInfo result = instance.getMovieInfoImdb(test.getImdb(), language, appendToResponse);
|
||||
assertEquals("Wrong TMDB ID", test.getTmdb(), result.getId());
|
||||
assertEquals("Wrong title", test.getName(), result.getTitle());
|
||||
assertEquals(WRONG_TITLE, test.getName(), result.getTitle());
|
||||
TestSuite.test(result);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,7 +25,6 @@ import com.omertron.themoviedbapi.TestID;
|
||||
import com.omertron.themoviedbapi.model.network.Network;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import org.junit.AfterClass;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import org.junit.BeforeClass;
|
||||
import org.junit.Test;
|
||||
@@ -37,7 +36,7 @@ import org.junit.Test;
|
||||
public class TmdbNetworksTest extends AbstractTests {
|
||||
|
||||
private static TmdbNetworks instance;
|
||||
private static final List<TestID> testIDs = new ArrayList<>();
|
||||
private static final List<TestID> TEST_IDS = new ArrayList<>();
|
||||
|
||||
public TmdbNetworksTest() {
|
||||
}
|
||||
@@ -46,12 +45,8 @@ public class TmdbNetworksTest extends AbstractTests {
|
||||
public static void setUpClass() throws MovieDbException {
|
||||
doConfiguration();
|
||||
instance = new TmdbNetworks(getApiKey(), getHttpTools());
|
||||
testIDs.add(new TestID("Fuji Television", "", 1));
|
||||
testIDs.add(new TestID("Sonshine Media Network International", "", 200));
|
||||
}
|
||||
|
||||
@AfterClass
|
||||
public static void tearDownClass() {
|
||||
TEST_IDS.add(new TestID("Fuji Television", "", 1));
|
||||
TEST_IDS.add(new TestID("Sonshine Media Network International", "", 200));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -64,7 +59,7 @@ public class TmdbNetworksTest extends AbstractTests {
|
||||
LOG.info("getNetworkInfo");
|
||||
|
||||
Network result;
|
||||
for (TestID t : testIDs) {
|
||||
for (TestID t : TEST_IDS) {
|
||||
result = instance.getNetworkInfo(t.getTmdb());
|
||||
assertEquals("Wrong network returned", t.getName(), result.getName());
|
||||
}
|
||||
|
||||
@@ -45,13 +45,10 @@ import java.util.Date;
|
||||
import java.util.List;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
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 org.junit.Before;
|
||||
import org.junit.BeforeClass;
|
||||
import org.junit.Test;
|
||||
|
||||
@@ -63,6 +60,9 @@ public class TmdbPeopleTest extends AbstractTests {
|
||||
|
||||
private static TmdbPeople instance;
|
||||
private static final List<TestID> TEST_IDS = new ArrayList<>();
|
||||
private static final String NO_TITLE = "No title";
|
||||
private static final String INCORRECT_ID = "Incorrect ID";
|
||||
private static final String ID_CAST_CREW = "ID: {}, # Cast: {}, # Crew: {}";
|
||||
|
||||
public TmdbPeopleTest() {
|
||||
}
|
||||
@@ -75,18 +75,6 @@ public class TmdbPeopleTest extends AbstractTests {
|
||||
TEST_IDS.add(new TestID("Will Smith", "nm0000226", 2888));
|
||||
}
|
||||
|
||||
@AfterClass
|
||||
public static void tearDownClass() {
|
||||
}
|
||||
|
||||
@Before
|
||||
public void setUp() {
|
||||
}
|
||||
|
||||
@After
|
||||
public void tearDown() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Test of Append_To_Response method, of class TmdbPeople.
|
||||
*
|
||||
@@ -142,14 +130,14 @@ public class TmdbPeopleTest extends AbstractTests {
|
||||
|
||||
for (TestID test : TEST_IDS) {
|
||||
PersonCreditList<CreditMovieBasic> result = instance.getPersonMovieCredits(test.getTmdb(), language);
|
||||
LOG.info("ID: {}, # Cast: {}, # Crew: {}", result.getId(), result.getCast().size(), result.getCrew().size());
|
||||
assertEquals("Incorrect ID", test.getTmdb(), result.getId());
|
||||
LOG.info(ID_CAST_CREW, result.getId(), result.getCast().size(), result.getCrew().size());
|
||||
assertEquals(INCORRECT_ID, test.getTmdb(), result.getId());
|
||||
TestSuite.test(result.getCast(), "Cast");
|
||||
TestSuite.test(result.getCrew(), "Crew");
|
||||
|
||||
// Check that we have the movie specific fields
|
||||
assertTrue("No title", StringUtils.isNotBlank(result.getCast().get(0).getTitle()));
|
||||
assertTrue("No title", StringUtils.isNotBlank(result.getCrew().get(0).getTitle()));
|
||||
assertTrue(NO_TITLE, StringUtils.isNotBlank(result.getCast().get(0).getTitle()));
|
||||
assertTrue(NO_TITLE, StringUtils.isNotBlank(result.getCrew().get(0).getTitle()));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -165,14 +153,14 @@ public class TmdbPeopleTest extends AbstractTests {
|
||||
|
||||
for (TestID test : TEST_IDS) {
|
||||
PersonCreditList<CreditTVBasic> result = instance.getPersonTVCredits(test.getTmdb(), language);
|
||||
LOG.info("ID: {}, # Cast: {}, # Crew: {}", result.getId(), result.getCast().size(), result.getCrew().size());
|
||||
assertEquals("Incorrect ID", test.getTmdb(), result.getId());
|
||||
LOG.info(ID_CAST_CREW, result.getId(), result.getCast().size(), result.getCrew().size());
|
||||
assertEquals(INCORRECT_ID, test.getTmdb(), result.getId());
|
||||
TestSuite.test(result.getCast(), "Cast");
|
||||
TestSuite.test(result.getCrew(), "Crew");
|
||||
|
||||
// Check that we have the TV specific fields
|
||||
assertTrue("No title", StringUtils.isNotBlank(result.getCast().get(0).getName()));
|
||||
assertTrue("No title", StringUtils.isNotBlank(result.getCrew().get(0).getName()));
|
||||
assertTrue(NO_TITLE, StringUtils.isNotBlank(result.getCast().get(0).getName()));
|
||||
assertTrue(NO_TITLE, StringUtils.isNotBlank(result.getCrew().get(0).getName()));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -188,8 +176,8 @@ public class TmdbPeopleTest extends AbstractTests {
|
||||
|
||||
for (TestID test : TEST_IDS) {
|
||||
PersonCreditList<CreditBasic> result = instance.getPersonCombinedCredits(test.getTmdb(), language);
|
||||
LOG.info("ID: {}, # Cast: {}, # Crew: {}", result.getId(), result.getCast().size(), result.getCrew().size());
|
||||
assertEquals("Incorrect ID", test.getTmdb(), result.getId());
|
||||
LOG.info(ID_CAST_CREW, result.getId(), result.getCast().size(), result.getCrew().size());
|
||||
assertEquals(INCORRECT_ID, test.getTmdb(), result.getId());
|
||||
TestSuite.test(result.getCast(), "Cast");
|
||||
TestSuite.test(result.getCrew(), "Crew");
|
||||
|
||||
@@ -219,7 +207,7 @@ public class TmdbPeopleTest extends AbstractTests {
|
||||
for (CreditBasic p : result.getCrew()) {
|
||||
if (!checkedMovie && p.getMediaType() == MediaType.MOVIE) {
|
||||
CreditMovieBasic c = (CreditMovieBasic) p;
|
||||
assertTrue("No title", StringUtils.isNotBlank(c.getTitle()));
|
||||
assertTrue(NO_TITLE, StringUtils.isNotBlank(c.getTitle()));
|
||||
assertTrue("No department", StringUtils.isNotBlank(c.getDepartment()));
|
||||
checkedMovie = true;
|
||||
}
|
||||
|
||||
@@ -23,12 +23,9 @@ import com.omertron.themoviedbapi.AbstractTests;
|
||||
import com.omertron.themoviedbapi.MovieDbException;
|
||||
import com.omertron.themoviedbapi.model.review.Review;
|
||||
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.assertNotNull;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import org.junit.Before;
|
||||
import org.junit.BeforeClass;
|
||||
import org.junit.Test;
|
||||
|
||||
@@ -49,18 +46,6 @@ public class TmdbReviewsTest extends AbstractTests {
|
||||
instance = new TmdbReviews(getApiKey(), getHttpTools());
|
||||
}
|
||||
|
||||
@AfterClass
|
||||
public static void tearDownClass() {
|
||||
}
|
||||
|
||||
@Before
|
||||
public void setUp() {
|
||||
}
|
||||
|
||||
@After
|
||||
public void tearDown() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Test of getReview method, of class TmdbReviews.
|
||||
*
|
||||
|
||||
@@ -36,12 +36,9 @@ import com.omertron.themoviedbapi.model.tv.TVSeasonInfo;
|
||||
import com.omertron.themoviedbapi.results.ResultList;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import org.junit.After;
|
||||
import org.junit.AfterClass;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import org.junit.Before;
|
||||
import org.junit.BeforeClass;
|
||||
import org.junit.Test;
|
||||
|
||||
@@ -53,6 +50,7 @@ public class TmdbSeasonsTest extends AbstractTests {
|
||||
|
||||
private static TmdbSeasons instance;
|
||||
private static final List<TestID> TV_IDS = new ArrayList<>();
|
||||
private static final String TESTING = "Testing: {}";
|
||||
|
||||
public TmdbSeasonsTest() {
|
||||
}
|
||||
@@ -67,18 +65,6 @@ public class TmdbSeasonsTest extends AbstractTests {
|
||||
TV_IDS.add(new TestID("The Big Bang Theory", "tt0898266", 1418, "Kaley Cuoco"));
|
||||
}
|
||||
|
||||
@AfterClass
|
||||
public static void tearDownClass() {
|
||||
}
|
||||
|
||||
@Before
|
||||
public void setUp() {
|
||||
}
|
||||
|
||||
@After
|
||||
public void tearDown() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Test of getSeasonInfo method, of class TmdbSeasons.
|
||||
*
|
||||
@@ -93,7 +79,7 @@ public class TmdbSeasonsTest extends AbstractTests {
|
||||
String appendToResponse = appendToResponseBuilder(TVSeasonMethod.class);
|
||||
|
||||
for (TestID test : TV_IDS) {
|
||||
LOG.info("Testing: {}", test);
|
||||
LOG.info(TESTING, test);
|
||||
TVSeasonInfo result = instance.getSeasonInfo(test.getTmdb(), seasonNumber, language, appendToResponse);
|
||||
TestSuite.test(result);
|
||||
TestSuite.testATR(result, TVSeasonMethod.class, null);
|
||||
@@ -125,7 +111,7 @@ public class TmdbSeasonsTest extends AbstractTests {
|
||||
LOG.info("getSeasonAccountState");
|
||||
|
||||
for (TestID test : TV_IDS) {
|
||||
LOG.info("Testing: {}", test);
|
||||
LOG.info(TESTING, test);
|
||||
MediaState result = instance.getSeasonAccountState(test.getTmdb(), getSessionId());
|
||||
TestSuite.test(result);
|
||||
}
|
||||
@@ -143,7 +129,7 @@ public class TmdbSeasonsTest extends AbstractTests {
|
||||
int seasonNumber = 0;
|
||||
|
||||
for (TestID test : TV_IDS) {
|
||||
LOG.info("Testing: {}", test);
|
||||
LOG.info(TESTING, test);
|
||||
MediaCreditList result = instance.getSeasonCredits(test.getTmdb(), seasonNumber);
|
||||
|
||||
assertNotNull(result);
|
||||
@@ -177,7 +163,7 @@ public class TmdbSeasonsTest extends AbstractTests {
|
||||
String language = LANGUAGE_DEFAULT;
|
||||
|
||||
for (TestID test : TV_IDS) {
|
||||
LOG.info("Testing: {}", test);
|
||||
LOG.info(TESTING, test);
|
||||
ExternalID result = instance.getSeasonExternalID(test.getTmdb(), seasonNumber, language);
|
||||
assertEquals("Wrong IMDB ID", test.getImdb(), result.getImdbId());
|
||||
}
|
||||
@@ -199,7 +185,7 @@ public class TmdbSeasonsTest extends AbstractTests {
|
||||
ArtworkResults results = new ArtworkResults();
|
||||
|
||||
for (TestID test : TV_IDS) {
|
||||
LOG.info("Testing: {}", test);
|
||||
LOG.info(TESTING, test);
|
||||
ResultList<Artwork> result = instance.getSeasonImages(test.getTmdb(), seasonNumber, language, includeImageLanguage);
|
||||
TestSuite.test(result, "Artwork");
|
||||
for (Artwork artwork : result.getResults()) {
|
||||
@@ -225,7 +211,7 @@ public class TmdbSeasonsTest extends AbstractTests {
|
||||
boolean found = false;
|
||||
|
||||
for (TestID test : TV_IDS) {
|
||||
LOG.info("Testing: {}", test);
|
||||
LOG.info(TESTING, test);
|
||||
ResultList<Video> result = instance.getSeasonVideos(test.getTmdb(), seasonNumber, language);
|
||||
found = found || !result.isEmpty();
|
||||
}
|
||||
|
||||
@@ -39,6 +39,7 @@ public class ApiUrlTest {
|
||||
|
||||
private static final Logger LOG = LoggerFactory.getLogger(ApiUrlTest.class);
|
||||
private static final String APIKEY = "APIKEY";
|
||||
private static final String QUERY = "query";
|
||||
|
||||
public ApiUrlTest() {
|
||||
}
|
||||
@@ -73,7 +74,7 @@ public class ApiUrlTest {
|
||||
public void testQuery() {
|
||||
LOG.info("Query Test");
|
||||
TmdbParameters parameters = new TmdbParameters();
|
||||
parameters.add(Param.QUERY, "query");
|
||||
parameters.add(Param.QUERY, QUERY);
|
||||
|
||||
URL result = new ApiUrl(APIKEY, MethodBase.MOVIE).buildUrl(parameters);
|
||||
String expResult = "http://api.themoviedb.org/3/movie?api_key=APIKEY&query=query";
|
||||
@@ -84,7 +85,7 @@ public class ApiUrlTest {
|
||||
public void testQuerySub() {
|
||||
LOG.info("Query-Sub Test");
|
||||
TmdbParameters parameters = new TmdbParameters();
|
||||
parameters.add(Param.QUERY, "query");
|
||||
parameters.add(Param.QUERY, QUERY);
|
||||
|
||||
URL result = new ApiUrl(APIKEY, MethodBase.MOVIE).subMethod(MethodSub.LATEST).buildUrl(parameters);
|
||||
String expResult = "http://api.themoviedb.org/3/movie/latest?api_key=APIKEY&query=query";
|
||||
@@ -95,7 +96,7 @@ public class ApiUrlTest {
|
||||
public void testQueryExtra() {
|
||||
LOG.info("Query Extra Test");
|
||||
TmdbParameters parameters = new TmdbParameters();
|
||||
parameters.add(Param.QUERY, "query");
|
||||
parameters.add(Param.QUERY, QUERY);
|
||||
parameters.add(Param.PAGE, 1);
|
||||
parameters.add(Param.LANGUAGE, "lang");
|
||||
|
||||
|
||||
Reference in New Issue
Block a user