Exemplo 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
    }
  }
Exemplo 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;
    }
  }
Exemplo n.º 3
0
  /**
   * Test of getTVChanges method, of class TmdbTV.
   *
   * @throws com.omertron.themoviedbapi.MovieDbException
   */
  @Test
  public void testGetTVChanges() throws MovieDbException {
    LOG.info("getTVChanges");
    SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
    String startDate = sdf.format(DateUtils.addDays(new Date(), -14));
    String endDate = "";
    int maxCheck = 5;

    TmdbChanges chgs = new TmdbChanges(getApiKey(), getHttpTools());
    ResultList<ChangeListItem> changeList = chgs.getChangeList(MethodBase.TV, null, null, null);
    LOG.info(
        "Found {} changes to check, will check maximum of {}",
        changeList.getResults().size(),
        maxCheck);

    int count = 1;
    ResultList<ChangeKeyItem> result;
    for (ChangeListItem item : changeList.getResults()) {
      result = instance.getTVChanges(item.getId(), startDate, endDate);
      for (ChangeKeyItem ci : result.getResults()) {
        assertNotNull("Null changes", ci);
      }

      if (count++ > maxCheck) {
        break;
      }
    }
  }
Exemplo n.º 4
0
  /**
   * Test of getLatestTV method, of class TmdbTV.
   *
   * @throws com.omertron.themoviedbapi.MovieDbException
   */
  @Test
  public void testGetTVLatest() throws MovieDbException {
    LOG.info("getTVLatest");

    TVInfo result = instance.getLatestTV();
    assertTrue("Missing ID", result.getId() > 0);
    assertTrue("Missing Name", StringUtils.isNotBlank(result.getName()));
  }
Exemplo n.º 5
0
  /**
   * Test of getTVPopular method, of class TmdbTV.
   *
   * @throws com.omertron.themoviedbapi.MovieDbException
   */
  @Test
  public void testGetTVPopular() throws MovieDbException {
    LOG.info("getTVPopular");
    Integer page = null;
    String language = LANGUAGE_DEFAULT;

    ResultList<TVInfo> result = instance.getTVPopular(page, language);
    TestSuite.test(result, "tv Popular");
  }
Exemplo n.º 6
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");
    }
  }
Exemplo n.º 7
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");
    }
  }
Exemplo n.º 8
0
  /**
   * Test of getTVAiringToday method, of class TmdbTV.
   *
   * @throws com.omertron.themoviedbapi.MovieDbException
   */
  @Test
  public void testGetTVAiringToday() throws MovieDbException {
    LOG.info("getTVAiringToday");
    Integer page = null;
    String language = LANGUAGE_DEFAULT;
    String timezone = "";

    ResultList<TVInfo> result = instance.getTVAiringToday(page, language, timezone);
    TestSuite.test(result, "TV Airing");
  }
Exemplo n.º 9
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());
    }
  }
Exemplo n.º 10
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);
    }
  }
Exemplo n.º 11
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());
    }
  }
Exemplo n.º 12
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()));
    }
  }
Exemplo n.º 13
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");
    }
  }
Exemplo n.º 14
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);
    }
  }
Exemplo n.º 15
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);
  }
Exemplo n.º 16
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);
    }
  }