}
@Test
public void testSave() {
Employee worker1 = new Employee(50);
Employee worker2 = new Employee(100);
Employee worker4 = new Employee(200);
Employee worker5 = null;
worker4.setId(4L);
try {
worker1 = employeeDAO.save(worker1);
worker2 = employeeDAO.save(worker2);
worker4 = employeeDAO.save(worker4);
worker5 = employeeDAO.save(worker5);
} catch (UserAlreadyExist e) {
fail();
}
assertEquals(50, worker1.getSalary());
assertEquals(100, worker2.getSalary());
assertEquals(200, worker4.getSalary());
assertEquals(new Long(1), worker1.getId());
assertEquals(new Long(2), worker2.getId());
assertEquals(new Long(4), worker4.getId());
Employee worker11 = employeeDAO.get(1L);
Employee worker12 = employeeDAO.get(2L);
Employee worker14 = employeeDAO.get(4L);
assertEquals(50, worker11.getSalary());
assertEquals(100, worker12.getSalary());
assertEquals(200, worker14.getSalary());
assertEquals(new Long(1), worker11.getId());
assertEquals(new Long(2), worker12.getId());
assertEquals(new Long(4), worker14.getId());
assertTrue(worker5 == null);
Employee worker3 = new Employee(75);
worker3.setId(2L);
try {
employeeDAO.save(worker3);
fail();
} catch (UserAlreadyExist e) {