@Test
  public void testUpdate() throws Exception {
    Department preUpdatedDepartment = departmentDAO.get(did);
    Employee employee3 = new Employee("UPDATE", "UPDATE", "XXX-XXX-XXX", 40);
    preUpdatedDepartment.setDepartmentName("UPDATE");
    preUpdatedDepartment.getEmployees().add(employee3);
    departmentDAO.saveOrUpdate(preUpdatedDepartment);

    employee3.setDepartment(department);
    Department updatedDepartment = departmentDAO.get(did);
    eid3 = (Long) employeeDAO.saveOrUpdate(employee3);
    Employee updatedEmployee = employeeDAO.get(eid3);

    assertEquals(
        "Add method failed: wrong department name",
        preUpdatedDepartment.getDepartmentName(),
        updatedDepartment.getDepartmentName());
    assertEquals(
        "Add method failed: wrong employees",
        preUpdatedDepartment.getEmployees().size(),
        updatedDepartment.getEmployees().size());
    assertEquals(
        "Add method failed: wrong department",
        employee3.getDepartment(),
        updatedEmployee.getDepartment());
  }
  @Before
  public void setUp() throws Exception {
    department = new Department("TEST");
    did = (Long) departmentDAO.saveOrUpdate(department);

    employee1 = new Employee("TEST", "TEST", "xxx-xxx-xxx", 30);
    employee2 = new Employee("TEST", "TEST", "xxx-xxx-xxx", 35);

    employee1.setDepartment(department);
    employee2.setDepartment(department);

    eid1 = (Long) employeeDAO.saveOrUpdate(employee1);
    eid2 = (Long) employeeDAO.saveOrUpdate(employee2);
  }
  @Test
  public void testAdd() throws Exception {
    department.setDepartmentId(did);

    Employee addedEmployee1 = employeeDAO.get(eid1);
    Employee addedEmployee2 = employeeDAO.get(eid2);
    Department addedDepartment = departmentDAO.get(did);

    assertEquals(
        "Add method failed: wrong department name",
        addedDepartment.getDepartmentName(),
        department.getDepartmentName());
    assertEquals(
        "Add method failed: wrong employees",
        addedDepartment.getEmployees().size(),
        department.getEmployees().size());
    assertEquals(
        "Add method failed: wrong department",
        addedEmployee1.getDepartment(),
        employee1.getDepartment());
    assertEquals(
        "Add method failed: wrong department",
        addedEmployee2.getDepartment(),
        employee2.getDepartment());
  }