コード例 #1
0
 @Before
 public void setupLibrary() {
   directory = TestUtils.buildTestDirectory(getClass());
   library = new MediaLibrary();
   library.setName("I like monkeys");
   library.setBaseDirectory(directory);
 }
コード例 #2
0
 @Test(expected = DuplicateMediaLibraryException.class)
 public void testDuplicateMediaLibraryName() throws DuplicateMediaLibraryException {
   MediaLibrary duplicate = new MediaLibrary();
   duplicate.setName("I like monkeys");
   duplicate.setBaseDirectory(TestUtils.buildTestDirectory(getClass()));
   dao.save(library);
   dao.save(duplicate);
 }
コード例 #3
0
  @Test
  public void testMovieIsSavedCorrectly() throws IOException, CremaException {
    File file = TestUtils.buildFileRelativeToDirectory(directory, "movie.mpg");
    library.addMovie(file);
    assertFalse(library.getMoviesByFilePath().isEmpty());

    dao.save(library);
    MediaLibrary savedLibrary = dao.read(library.getName());
    Movie movie = savedLibrary.getMoviesByFilePath().values().iterator().next();

    assertSame(library, savedLibrary);
    assertFalse(savedLibrary.getMoviesByFilePath().isEmpty());
    assertEquals("movie.mpg", movie.getFirstMediaFile().getRelativePath());
  }