* fix stupids mistake...

This commit is contained in:
Reinhard Pointner 2012-11-18 16:18:16 +00:00
parent 2eeca8be77
commit 7bc9379671
2 changed files with 13 additions and 1 deletions

View File

@ -98,7 +98,7 @@ public class IMDbClient implements MovieIdentificationService {
try {
int imdbid = getImdbId(selectString("//LINK[@rel='canonical']/@href", dom));
Movie movie = getMovieDescriptor(imdbid, locale);
if (movie == null) {
if (movie != null) {
results.add(movie);
}
} catch (Exception e) {

View File

@ -27,6 +27,18 @@ public class IMDbClientTest {
}
@Test
public void searchMovieRedirect() throws Exception {
List<Movie> results = imdb.searchMovie("(500) Days of Summer (2009)", null);
Movie movie = results.get(0);
assertEquals("(500) Days of Summer", movie.getName());
assertEquals(2009, movie.getYear());
assertEquals(1022603, movie.getImdbId(), 0);
}
@Test
public void getMovieDescriptor() throws Exception {
Movie movie = imdb.getMovieDescriptor(499549, null);