@Before
 public void setupLibrary() {
   directory = TestUtils.buildTestDirectory(getClass());
   library = new MediaLibrary();
   library.setName("I like monkeys");
   library.setBaseDirectory(directory);
 }
 @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);
 }
  @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());
  }