2014-04-19 02:30:29 -04:00
|
|
|
package net.filebot.web;
|
2009-03-17 17:59:19 -04:00
|
|
|
|
2013-09-11 13:22:00 -04:00
|
|
|
import static org.junit.Assert.*;
|
2009-03-17 17:59:19 -04:00
|
|
|
|
|
|
|
import java.util.List;
|
|
|
|
|
2013-09-03 08:24:43 -04:00
|
|
|
import org.junit.Test;
|
2009-03-17 17:59:19 -04:00
|
|
|
|
2016-03-13 09:32:26 -04:00
|
|
|
import net.filebot.web.TMDbClient.MovieInfo;
|
|
|
|
|
2014-08-05 04:23:39 -04:00
|
|
|
public class OMDbClientTest {
|
2013-09-03 08:24:43 -04:00
|
|
|
|
2014-08-05 04:23:39 -04:00
|
|
|
private final OMDbClient client = new OMDbClient();
|
2013-09-03 08:24:43 -04:00
|
|
|
|
2012-01-06 12:24:00 -05:00
|
|
|
@Test
|
2012-12-02 04:36:59 -05:00
|
|
|
public void searchMovie1() throws Exception {
|
2014-08-05 04:23:39 -04:00
|
|
|
List<Movie> results = client.searchMovie("Avatar", null);
|
2012-07-20 07:45:18 -04:00
|
|
|
Movie movie = results.get(0);
|
2013-09-03 08:24:43 -04:00
|
|
|
|
2012-01-06 12:24:00 -05:00
|
|
|
assertEquals("Avatar", movie.getName());
|
|
|
|
assertEquals(2009, movie.getYear());
|
|
|
|
assertEquals(499549, movie.getImdbId(), 0);
|
|
|
|
}
|
2013-09-03 08:24:43 -04:00
|
|
|
|
2012-12-01 09:55:34 -05:00
|
|
|
@Test
|
|
|
|
public void searchMovie2() throws Exception {
|
2016-03-06 17:21:13 -05:00
|
|
|
List<Movie> results = client.searchMovie("The Terminator", null);
|
2012-12-01 09:55:34 -05:00
|
|
|
Movie movie = results.get(0);
|
2013-09-03 08:24:43 -04:00
|
|
|
|
2016-03-06 17:21:13 -05:00
|
|
|
assertEquals("The Terminator", movie.getName());
|
|
|
|
assertEquals(1984, movie.getYear());
|
|
|
|
assertEquals(88247, movie.getImdbId());
|
2012-12-01 09:55:34 -05:00
|
|
|
}
|
2013-09-03 08:24:43 -04:00
|
|
|
|
2012-12-02 04:36:59 -05:00
|
|
|
@Test
|
|
|
|
public void searchMovie3() throws Exception {
|
2014-08-05 04:23:39 -04:00
|
|
|
List<Movie> results = client.searchMovie("Amélie", null);
|
2012-12-02 04:36:59 -05:00
|
|
|
Movie movie = results.get(0);
|
2013-09-03 08:24:43 -04:00
|
|
|
|
2012-12-02 04:36:59 -05:00
|
|
|
assertEquals("Amélie", movie.getName());
|
|
|
|
assertEquals(2001, movie.getYear());
|
|
|
|
assertEquals(211915, movie.getImdbId(), 0);
|
|
|
|
}
|
2013-09-03 08:24:43 -04:00
|
|
|
|
2012-12-02 08:41:06 -05:00
|
|
|
@Test
|
|
|
|
public void searchMovie4() throws Exception {
|
2014-08-05 04:23:39 -04:00
|
|
|
List<Movie> results = client.searchMovie("Heat", null);
|
2012-12-02 08:41:06 -05:00
|
|
|
Movie movie = results.get(0);
|
2013-09-03 08:24:43 -04:00
|
|
|
|
2012-12-02 08:41:06 -05:00
|
|
|
assertEquals("Heat", movie.getName());
|
|
|
|
assertEquals(1995, movie.getYear());
|
|
|
|
assertEquals(113277, movie.getImdbId(), 0);
|
|
|
|
}
|
2013-09-03 08:24:43 -04:00
|
|
|
|
2013-01-12 22:15:05 -05:00
|
|
|
@Test
|
|
|
|
public void searchMovie6() throws Exception {
|
2014-08-05 04:23:39 -04:00
|
|
|
List<Movie> results = client.searchMovie("Drive 2011", null);
|
2013-01-12 22:15:05 -05:00
|
|
|
Movie movie = results.get(0);
|
2013-09-03 08:24:43 -04:00
|
|
|
|
2013-01-12 22:15:05 -05:00
|
|
|
assertEquals("Drive", movie.getName());
|
|
|
|
assertEquals(2011, movie.getYear());
|
|
|
|
assertEquals(780504, movie.getImdbId(), 0);
|
|
|
|
}
|
2013-09-03 08:24:43 -04:00
|
|
|
|
2012-01-06 12:24:00 -05:00
|
|
|
@Test
|
2012-12-02 04:36:59 -05:00
|
|
|
public void getMovieDescriptor1() throws Exception {
|
2014-09-15 16:35:13 -04:00
|
|
|
Movie movie = client.getMovieDescriptor(new Movie(null, 0, 499549, -1), null);
|
2013-09-03 08:24:43 -04:00
|
|
|
|
2012-01-06 12:24:00 -05:00
|
|
|
assertEquals("Avatar", movie.getName());
|
|
|
|
assertEquals(2009, movie.getYear());
|
|
|
|
assertEquals(499549, movie.getImdbId(), 0);
|
|
|
|
}
|
2013-09-03 08:24:43 -04:00
|
|
|
|
2012-12-02 04:36:59 -05:00
|
|
|
@Test
|
|
|
|
public void getMovieDescriptor2() throws Exception {
|
2014-09-15 16:35:13 -04:00
|
|
|
Movie movie = client.getMovieDescriptor(new Movie(null, 0, 211915, -1), null);
|
2013-09-03 08:24:43 -04:00
|
|
|
|
2012-12-02 04:36:59 -05:00
|
|
|
assertEquals("Amélie", movie.getName());
|
|
|
|
assertEquals(2001, movie.getYear());
|
|
|
|
assertEquals(211915, movie.getImdbId(), 0);
|
|
|
|
}
|
2013-09-03 08:24:43 -04:00
|
|
|
|
2013-01-27 04:56:40 -05:00
|
|
|
@Test
|
|
|
|
public void getMovieDescriptor3() throws Exception {
|
2014-09-15 16:35:13 -04:00
|
|
|
Movie movie = client.getMovieDescriptor(new Movie(null, 0, 75610, -1), null);
|
2013-09-03 08:24:43 -04:00
|
|
|
|
2014-03-18 16:16:39 -04:00
|
|
|
assertEquals("21 Up", movie.getName());
|
2013-01-27 04:56:40 -05:00
|
|
|
assertEquals(1977, movie.getYear());
|
|
|
|
assertEquals(75610, movie.getImdbId(), 0);
|
|
|
|
}
|
2013-09-03 08:24:43 -04:00
|
|
|
|
2013-01-27 07:02:28 -05:00
|
|
|
@Test
|
|
|
|
public void getMovieDescriptor4() throws Exception {
|
2014-09-15 16:35:13 -04:00
|
|
|
Movie movie = client.getMovieDescriptor(new Movie(null, 0, 369702, -1), null);
|
2013-09-03 08:24:43 -04:00
|
|
|
|
2013-01-27 07:02:28 -05:00
|
|
|
assertEquals("The Sea Inside", movie.getName());
|
|
|
|
assertEquals(2004, movie.getYear());
|
|
|
|
assertEquals(369702, movie.getImdbId(), 0);
|
|
|
|
}
|
2013-09-03 08:24:43 -04:00
|
|
|
|
2013-02-22 12:26:34 -05:00
|
|
|
@Test
|
|
|
|
public void getMovieDescriptor5() throws Exception {
|
2014-09-15 16:35:13 -04:00
|
|
|
Movie movie = client.getMovieDescriptor(new Movie(null, 0, 1020960, -1), null);
|
2013-09-03 08:24:43 -04:00
|
|
|
|
2013-02-22 12:26:34 -05:00
|
|
|
assertEquals("God, the Universe and Everything Else", movie.getName());
|
|
|
|
assertEquals(1988, movie.getYear());
|
|
|
|
assertEquals(1020960, movie.getImdbId(), 0);
|
|
|
|
}
|
2013-09-03 08:24:43 -04:00
|
|
|
|
|
|
|
@Test
|
|
|
|
public void getImdbApiMovieInfoReleasedNA() throws Exception {
|
2014-08-05 04:23:39 -04:00
|
|
|
MovieInfo movie = client.getMovieInfo(new Movie(null, -1, 1287357, -1));
|
2013-09-03 08:24:43 -04:00
|
|
|
assertEquals("Sommersonntag", movie.getName());
|
|
|
|
assertEquals(2008, movie.getReleased().getYear());
|
2014-03-18 16:16:39 -04:00
|
|
|
assertEquals("2008-06-07", movie.getReleased().toString());
|
2013-09-03 08:24:43 -04:00
|
|
|
}
|
|
|
|
|
2009-03-17 17:59:19 -04:00
|
|
|
}
|