@Before
  public void setUp() {
    try {
      sessionFactory = HibernateUtility.getSessionFactory();
      dao = new HibernateEmployeeDao();
      dao.setSessionFactory(sessionFactory);

      service = new EmployeeService();
      service.setDao(dao);
    } finally {
      sessionFactory.getCurrentSession().beginTransaction();
    }
  }
  @Test
  public void test3PaycheckCreation() {
    Calendar start = Calendar.getInstance();
    start.add(Calendar.DAY_OF_YEAR, -21);

    Calendar end = Calendar.getInstance();
    end.add(Calendar.DAY_OF_YEAR, -7);

    PayCheck check = service.createPaycheck("12341234", start.getTime(), end.getTime(), 40);

    flushSession();

    assertTrue(check.getId() > 0);
    assertEquals(1, check.getAssociatedEmployee().getPayChecks().size());
    assertNotNull(check.getCreatedOn());
    assertEquals("Anonymous", check.getCreatedBy());
  }
  @Test
  public void test2SalaryEmployeeCreation() {

    SalaryPayRate spr = new SalaryPayRate();
    spr.setJobRole("Programmer");
    spr.setYearlyRate(50000.00);

    Employee employee =
        service.createNewEmployee("David", "Dobel", "11111111", spr, createDefaultAddress());

    flushSession();

    assertTrue(employee.getId() > 0);
    assertTrue(employee.getPay() instanceof SalaryPayRate);
    assertNotNull(employee.getCreatedOn());
    assertEquals("Anonymous", employee.getCreatedBy());
    assertNotNull(employee.getUpdatedBy());
    assertNotNull(employee.getUpdatedOn());
  }
  @Test
  public void test1HourlyEmployeeCreation() {
    HourlyPayRate hpr = new HourlyPayRate();
    hpr.setJobRole("Programmer");
    hpr.setHourlyPayRate(50.00);
    hpr.setOvertimeRate(75.00);

    Employee employee =
        service.createNewEmployee("Sid", "Waterman", "12341234", hpr, createDefaultAddress());

    flushSession();

    assertTrue(employee.getId() > 0);
    assertTrue(employee.getPay() instanceof HourlyPayRate);
    assertNotNull(employee.getCreatedOn());
    assertEquals("Anonymous", employee.getCreatedBy());
    assertNotNull(employee.getUpdatedBy());
    assertNotNull(employee.getUpdatedOn());
  }