public void testSave() throws SQLException {
    List<Day> daysBefore = dayManager.getAll();
    Assert.assertEquals(daysBefore.size(), 1);

    Day day = new Day();
    day.setId(100L);
    day.setName("Lunedì");

    Calendar calendar = GregorianCalendar.getInstance();
    calendar.set(Calendar.YEAR, 2014);
    calendar.set(Calendar.MONTH, Calendar.OCTOBER);
    calendar.set(Calendar.DAY_OF_MONTH, 27);
    calendar.set(Calendar.HOUR_OF_DAY, 9);
    calendar.set(Calendar.MINUTE, 0);
    calendar.set(Calendar.SECOND, 0);

    day.setDayDate(calendar.getTime());

    dayManager.save(day);

    List<Day> daysAfter = dayManager.getAll();
    Assert.assertEquals(daysAfter.size(), 2);

    Day savedDay = dayManager.get(day.getId());
    Assert.assertEquals(savedDay.getId(), day.getId());
    Assert.assertEquals(savedDay.getName(), day.getName());

    boolean areDatesEqual =
        DateUtils.truncatedEquals(savedDay.getDayDate(), calendar.getTime(), Calendar.SECOND);
    Assert.assertTrue(areDatesEqual);
  }
  public void testDelete() throws SQLException {
    long dayId = 101L;
    Day day = new Day();
    day.setId(dayId);

    dayManager.delete(day);

    Day dayAfterDelete = dayManager.get(dayId);
    Assert.assertNull(dayAfterDelete);
  }