@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()); }
@Test public void findBySID() { Series s = repository.findByImdbId("testSeriesID"); assertThat(s.getTitle(), is("testSeries1")); s = repository.findByImdbId("NonExistingSID"); assertTrue(s == null); }
/** 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()); }