/** * Test of getInfo method, of class OmdbApi. * * @throws OMDBException */ @Test public void testMovieInfo_4args() throws OMDBException { LOG.info("movieInfo - All args"); OmdbVideoFull result = null; for (TestID test : IDS) { LOG.info("Testing: '{}'", test.getTitle()); result = omdb.getInfo( new OmdbBuilder() .setTitle(test.getTitle()) .setYear(test.getYear()) .setPlotLong() .setTomatoes(true) .build()); assertNotNull("Null object returned", result); assertTrue("Error with call", result.isResponse()); assertEquals("Wrong video returned", test.getImdb(), result.getImdbID()); assertTrue("No RT data", StringUtils.isNotBlank(result.getTomatoConsensus())); } try { result = omdb.getInfo(new OmdbBuilder().setTitle("Some movie that can't be found at all").build()); assertFalse("What do you mean this was found?", result.isResponse()); } catch (OMDBException ex) { assertNotNull("Null object returned", result); } }
/** * Test of getInfo method, of class OmdbApi. * * @throws OMDBException */ @Test public void testMovieInfo_ByTT() throws OMDBException { LOG.info("movieInfo_ByTT"); for (TestID test : IDS) { LOG.info("Testing: '{}'", test.getTitle()); OmdbVideoFull result = omdb.getInfo(new OmdbBuilder().setImdbId(test.getImdb()).build()); assertEquals("Wrong movie returned", test.getTitle(), result.getTitle()); } }
/** * Test of build method, of class OmdbApi. * * @throws OMDBException */ @Test public void testSearch_String_int() throws OMDBException { LOG.info("Search - Title & Year"); for (TestID test : IDS) { LOG.info("Testing: '{}'", test.getTitle()); SearchResults result = omdb.search(test.getTitle(), test.getYear()); assertNotNull("Null search returned", result); assertTrue("Error response", result.isResponse()); assertTrue("No records found", result.getResults().size() > 0); boolean found = false; for (OmdbVideoBasic movie : result.getResults()) { if (StringUtils.equals(test.getImdb(), movie.getImdbID())) { found = true; break; } } assertTrue("Movie not found in search results", found); } }