Esempio n. 1
0
  /**
   * Test of Append_To_Response method, of class TmdbTV.
   *
   * @throws com.omertron.themoviedbapi.MovieDbException
   */
  @Test
  public void testAppendToResponse() throws MovieDbException {
    LOG.info("appendToResponse");

    String language = LANGUAGE_DEFAULT;
    String appendToResponse = appendToResponseBuilder(TVMethod.class);

    for (TestID test : TV_IDS) {
      // Just test Waling Dead
      if (test.getTmdb() != 1402) {
        continue;
      }

      TVInfo result = instance.getTVInfo(test.getTmdb(), language, appendToResponse);
      TestSuite.test(result);
      TestSuite.testATR(result, TVMethod.class, null);
      TestSuite.test(result.getAlternativeTitles(), "Alt titles");
      TestSuite.test(result.getContentRatings(), "Content Ratings");
      TestSuite.test(result.getCredits());
      TestSuite.test(result.getExternalIDs());
      TestSuite.test(result.getImages(), "Images");
      TestSuite.test(result.getKeywords(), "Keywords");
      TestSuite.test(result.getVideos(), "Videos");
      TestSuite.test(result.getTranslations(), "Translations");
      TestSuite.test(result.getSimilarTV(), "Similar");
      // There are rarely any changes, so skip this test
    }
  }
Esempio n. 2
0
  /**
   * Test of getTVCredits method, of class TmdbTV.
   *
   * @throws com.omertron.themoviedbapi.MovieDbException
   */
  @Test
  public void testGetTVCredits() throws MovieDbException {
    LOG.info("getTVCredits");

    for (TestID test : TV_IDS) {
      MediaCreditList result = instance.getTVCredits(test.getTmdb(), LANGUAGE_DEFAULT);
      assertNotNull(result);
      assertFalse(result.getCast().isEmpty());

      boolean found = false;
      for (MediaCreditCast p : result.getCast()) {
        if (test.getOther().equals(p.getName())) {
          found = true;
          break;
        }
      }
      assertTrue(test.getOther() + " not found in cast!", found);

      // Only breaking bad has crew
      if (test.getTmdb() == 1396) {
        assertFalse(result.getCrew().isEmpty());
      }
      break;
    }
  }
Esempio n. 3
0
  /**
   * Test of getTVTranslations method, of class TmdbTV.
   *
   * @throws com.omertron.themoviedbapi.MovieDbException
   */
  @Test
  public void testGetTVTranslations() throws MovieDbException {
    LOG.info("getTVTranslations");

    for (TestID test : TV_IDS) {
      ResultList<Translation> result = instance.getTVTranslations(test.getTmdb());
      TestSuite.test(result, "TV Translations");
    }
  }
Esempio n. 4
0
  /**
   * Test of getTVAlternativeTitles method, of class TmdbTV.
   *
   * @throws com.omertron.themoviedbapi.MovieDbException
   */
  @Test
  public void testGetTVAlternativeTitles() throws MovieDbException {
    LOG.info("getTVAlternativeTitles");

    for (TestID test : TV_IDS) {
      ResultList<AlternativeTitle> result = instance.getTVAlternativeTitles(test.getTmdb());
      TestSuite.test(result, "TV Alt Titles");
    }
  }
Esempio n. 5
0
  /**
   * Test of postTVRating method, of class TmdbTV.
   *
   * @throws com.omertron.themoviedbapi.MovieDbException
   */
  @Test
  public void testPostTVRating() throws MovieDbException {
    LOG.info("postTVRating");

    for (TestID test : TV_IDS) {
      int rating = TestSuite.randomRating();
      StatusCode result = instance.postTVRating(test.getTmdb(), rating, getSessionId(), null);
      assertEquals("failed to post rating", 12, result.getCode());
    }
  }
Esempio n. 6
0
  /**
   * Test of getTVAccountState method, of class TmdbTV.
   *
   * @throws com.omertron.themoviedbapi.MovieDbException
   */
  @Test
  public void testGetTVAccountState() throws MovieDbException {
    LOG.info("getTVAccountState");

    for (TestID test : TV_IDS) {
      MediaState result = instance.getTVAccountState(test.getTmdb(), getSessionId());
      assertNotNull("Null result", result);
      assertTrue("Invalid rating", result.getRated() > -2f);
    }
  }
Esempio n. 7
0
  /**
   * Test of getTVExternalIDs method, of class TmdbTV.
   *
   * @throws com.omertron.themoviedbapi.MovieDbException
   */
  @Test
  public void testGetTVExternalIDs() throws MovieDbException {
    LOG.info("getTVExternalIDs");

    String language = LANGUAGE_DEFAULT;

    for (TestID test : TV_IDS) {
      ExternalID result = instance.getTVExternalIDs(test.getTmdb(), language);
      assertEquals("Wrong IMDB ID", test.getImdb(), result.getImdbId());
    }
  }
Esempio n. 8
0
  /**
   * Test of getTVContentRatings method, of class TmdbTV.
   *
   * @throws com.omertron.themoviedbapi.MovieDbException
   */
  @Test
  public void testGetTVContentRatings() throws MovieDbException {
    LOG.info("getTVContentRatings");

    for (TestID test : TV_IDS) {
      ResultList<ContentRating> result = instance.getTVContentRatings(test.getTmdb());
      TestSuite.test(result, "TV Content Rating");
      assertTrue("No language", StringUtils.isNotBlank(result.getResults().get(0).getCountry()));
      assertTrue("No rating", StringUtils.isNotBlank(result.getResults().get(0).getRating()));
    }
  }
Esempio n. 9
0
  /**
   * Test of getTVSimilar method, of class TmdbTV.
   *
   * @throws com.omertron.themoviedbapi.MovieDbException
   */
  @Test
  public void testGetTVSimilar() throws MovieDbException {
    LOG.info("getTVSimilar");

    Integer page = null;
    String language = LANGUAGE_DEFAULT;

    for (TestID test : TV_IDS) {
      ResultList<TVInfo> result = instance.getTVSimilar(test.getTmdb(), page, language);
      TestSuite.test(result, "TV Similar");
    }
  }
Esempio n. 10
0
  /**
   * Test of getTVInfo method, of class TmdbTV.
   *
   * @throws com.omertron.themoviedbapi.MovieDbException
   */
  @Test
  public void testGetTVInfo() throws MovieDbException {
    LOG.info("getTVInfo");

    String language = LANGUAGE_DEFAULT;
    String[] appendToResponse = null;

    for (TestID test : TV_IDS) {
      TVInfo result = instance.getTVInfo(test.getTmdb(), language, appendToResponse);
      TestSuite.test(result);
    }
  }
Esempio n. 11
0
  /**
   * Test of getTVVideos method, of class TmdbTV.
   *
   * @throws com.omertron.themoviedbapi.MovieDbException
   */
  @Test
  public void testGetTVVideos() throws MovieDbException {
    LOG.info("getTVVideos");

    String language = LANGUAGE_DEFAULT;
    boolean found = false;

    for (TestID test : TV_IDS) {
      ResultList<Video> result = instance.getTVVideos(test.getTmdb(), language);
      found = found || !result.isEmpty();
    }
    assertTrue("No videos", found);
  }
Esempio n. 12
0
  /**
   * Test of getTVImages method, of class TmdbTV.
   *
   * @throws com.omertron.themoviedbapi.MovieDbException
   */
  @Test
  public void testGetTVImages() throws MovieDbException {
    LOG.info("getTVImages");

    String language = LANGUAGE_DEFAULT;
    String[] includeImageLanguage = null;

    ArtworkResults results = new ArtworkResults();

    for (TestID test : TV_IDS) {
      ResultList<Artwork> result =
          instance.getTVImages(test.getTmdb(), language, includeImageLanguage);
      TestSuite.test(result, "TV Images");
      for (Artwork artwork : result.getResults()) {
        results.found(artwork.getArtworkType());
      }

      // We should only have posters & backdrops
      results.validateResults(ArtworkType.POSTER, ArtworkType.BACKDROP);
    }
  }