@Test
  public void testGetAverageNumberOfNotes3() {
    System.out.println("getAverageNumberOfNotes");

    dvdLibraryDao.create(dvd1);
    dvd2.getNotes().add(note5a);
    dvd2.getNotes().add(note5b);
    dvdLibraryDao.create(dvd2);
    dvd3.getNotes().add(note4a);
    dvd3.getNotes().add(note4b);
    dvdLibraryDao.create(dvd3);

    double result = dvdLibraryDao.getAverageNumberOfNotes();
    double expResult = 3.3333;

    Assert.assertEquals(expResult, result, 0.001);
  }
  @Before
  public void setUp() throws ParseException {
    while (!dvdLibraryDao.list().isEmpty()) {
      dvdLibraryDao.delete(dvdLibraryDao.list().get(0).getId());
    }

    sdf = new SimpleDateFormat("yyyy");
    date1 = sdf.parse("1999");
    date2 = sdf.parse("2000");
    date3 = sdf.parse("2001");
    date4 = sdf.parse("2002");
    date4a = sdf.parse("2001");
    date5 = sdf.parse("2003");

    note1a = new Note();
    note1b = new Note();
    note2a = new Note();
    note2b = new Note();
    note3a = new Note();
    note3b = new Note();
    note4a = new Note();
    note4b = new Note();
    note5a = new Note();
    note5b = new Note();

    note1a.setContent("Note1a");
    note1b.setContent("Note1b");
    note2a.setContent("Note2a");
    note2b.setContent("Note2b");
    note3a.setContent("Note3a");
    note3b.setContent("Note3b");

    note4a.setContent("Note4a");
    note4b.setContent("Note4b");
    note5a.setContent("Note5a");
    note5b.setContent("Note5b");

    dvd1 = new Dvd();
    dvd1.setNotes(new ArrayList<>());
    dvd2 = new Dvd();
    dvd2.setNotes(new ArrayList<>());
    dvd3 = new Dvd();
    dvd3.setNotes(new ArrayList<>());
    dvd4 = new Dvd();
    dvd4.setNotes(new ArrayList<>());
    dvd5 = new Dvd();
    dvd5.setNotes(new ArrayList<>());

    dvd1.setTitle("Title1");
    dvd1.setReleaseDate(date1);
    dvd1.setId(1);
    dvd1.setDirector("Director1");
    dvd1.setStudio("Studio1");
    dvd1.setMpaaRating("Rating1");
    dvd1.setUserRating(1);
    dvd1.getNotes().add(note1a);
    dvd1.getNotes().add(note1b);

    dvd2.setTitle("Title2");
    dvd2.setReleaseDate(date2);
    dvd2.setId(2);
    dvd2.setDirector("Director2");
    dvd2.setStudio("Studio2");
    dvd2.setMpaaRating("Rating2");
    dvd2.setUserRating(2);
    dvd2.getNotes().add(note2a);
    dvd2.getNotes().add(note2b);

    dvd3.setTitle("Title3");
    dvd3.setReleaseDate(date3);
    dvd3.setId(3);
    dvd3.setDirector("Director3");
    dvd3.setStudio("Studio3");
    dvd3.setMpaaRating("Rating3");
    dvd3.setUserRating(3);
    dvd3.getNotes().add(note3a);
    dvd3.getNotes().add(note3b);

    dvd4.setId(4);
    dvd4.setTitle("Title4");
    dvd4.setReleaseDate(date4);
    dvd4.setDirector("Director4");
    dvd4.setStudio("Studio4");
    dvd4.setMpaaRating("Rating4");
    dvd4.setUserRating(4);
  }