コード例 #1
0
  @Test
  public void saveGetAndUpdateSeriesWithEpisodes() {
    Series serie = new Series("EpisodeSeriesTest", "estID");
    List<Episode> eList = new ArrayList<>();
    eList.add(new Episode("title", "path1", 1, 1));
    eList.add(new Episode("title", "path2", 1, 2));
    serie.setEpisodes(eList);
    repository.save(serie);

    Series serieRe = repository.findByImdbId("estID");
    List<Episode> reEp = serieRe.getEpisodes();
    assertThat(reEp, hasSize(2));

    serieRe.getEpisodes().add(new Episode("title", "path3", 1, 3));
    repository.save(serieRe);

    serieRe = repository.findByImdbId("estID");
    reEp = serieRe.getEpisodes();
    assertThat(reEp, hasSize(3));

    Episode e = eRepository.findByFilePath("path1");
    assertEquals("title", e.getTitle());

    e = eRepository.findByFilePath("path2");
    assertEquals("title", e.getTitle());
  }
コード例 #2
0
 @Test(expected = DataIntegrityViolationException.class)
 public void createMultipleSeriesWithSameSeriesID() {
   // sID unique, this should not be possible.
   Series s1 = new Series("SeriesTest2", "SeriesTest2id");
   Series s2 = new Series("SeriesTest3", "SeriesTest2id");
   repository.save(s1);
   repository.save(s2);
 }
コード例 #3
0
  /** Tests for series - episode relations */
  @Test
  public void saveAndGetSeriesWithEpisodes() {
    Series serie = new Series("EpisodeSeriesTest", "estID");
    List<Episode> eList = new ArrayList<>();
    eList.add(new Episode("title", "path1", 1, 1));
    eList.add(new Episode("title", "path2", 1, 2));
    serie.setEpisodes(eList);
    repository.save(serie);

    Series serieRe = repository.findByImdbId("estID");
    List<Episode> reEp = serieRe.getEpisodes();
    assertThat(reEp, hasSize(2));
    assertEquals("title", reEp.get(0).getTitle());
  }
コード例 #4
0
 @Test
 public void createSeries() {
   Series serie = new Series("SeriesTest2", "SeriesTest2id");
   repository.save(serie);
 }