Search in sources :

Example 81 with Employee

use of com.artezio.arttime.datamodel.Employee in project ART-TIME by Artezio.

the class EmployeeRepositoryTest method testUpdate.

@Test
public void testUpdate() {
    Employee employee = new Employee("iivanov", "Ivan", "Ivanov", "iivanov@mail.com");
    entityManager.persist(employee);
    employee.setEmail("ivan.ivanov@mail.com");
    Employee actual = employeeRepository.update(employee);
    assertEquals("ivan.ivanov@mail.com", actual.getEmail());
}
Also used : Employee(com.artezio.arttime.datamodel.Employee) Test(org.junit.Test)

Example 82 with Employee

use of com.artezio.arttime.datamodel.Employee in project ART-TIME by Artezio.

the class EmployeeRepositoryTest method testCreate.

@Test
public void testCreate() {
    Employee employee = new Employee("employee");
    Employee actual = employeeRepository.create(employee);
    actual = entityManager.find(Employee.class, actual.getUserName());
    assertNotNull(actual);
}
Also used : Employee(com.artezio.arttime.datamodel.Employee) Test(org.junit.Test)

Example 83 with Employee

use of com.artezio.arttime.datamodel.Employee in project ART-TIME by Artezio.

the class HoursRepositoryTest method testFindHours.

@Test
public void testFindHours() throws Exception {
    Employee employee = new Employee("employ");
    Project project = new Project();
    project.setCode("PrCode");
    HourType hourType = new HourType();
    Date date = getOffsetDate(1);
    Hours expected = new Hours(project, date, employee, hourType);
    entityManager.persist(project);
    entityManager.persist(employee);
    entityManager.persist(hourType);
    entityManager.persist(expected);
    Hours actual = hoursRepository.findHours(employee.getUserName(), project.getCode(), hourType.getId(), date);
    assertEquals(expected, actual);
}
Also used : Project(com.artezio.arttime.datamodel.Project) Employee(com.artezio.arttime.datamodel.Employee) HourType(com.artezio.arttime.datamodel.HourType) Hours(com.artezio.arttime.datamodel.Hours) Date(java.util.Date) CalendarUtils.getOffsetDate(com.artezio.arttime.test.utils.CalendarUtils.getOffsetDate) Test(org.junit.Test)

Example 84 with Employee

use of com.artezio.arttime.datamodel.Employee in project ART-TIME by Artezio.

the class HoursRepositoryTest method testRemove.

@Test
public void testRemove() throws Exception {
    Employee employee = new Employee("employe");
    Project project = new Project();
    HourType hourType = new HourType();
    Hours hours = new Hours(project, sdf.parse("1-01-2015"), employee, hourType);
    entityManager.persist(project);
    entityManager.persist(employee);
    entityManager.persist(hourType);
    entityManager.persist(hours);
    hoursRepository.remove(hours);
    Hours actual = entityManager.find(Hours.class, hours.getId());
    assertNull(actual);
}
Also used : Project(com.artezio.arttime.datamodel.Project) Employee(com.artezio.arttime.datamodel.Employee) HourType(com.artezio.arttime.datamodel.HourType) Hours(com.artezio.arttime.datamodel.Hours) Test(org.junit.Test)

Example 85 with Employee

use of com.artezio.arttime.datamodel.Employee in project ART-TIME by Artezio.

the class HoursRepositoryTest method testGetApprovedActualHours_ifEmployeesIsEmpty.

@Test
public void testGetApprovedActualHours_ifEmployeesIsEmpty() {
    Period period = new Period();
    List<Employee> employees = new ArrayList<>();
    List<Hours> actual = hoursRepository.getApprovedActualHours(employees, period);
    assertTrue(actual.isEmpty());
}
Also used : Employee(com.artezio.arttime.datamodel.Employee) Hours(com.artezio.arttime.datamodel.Hours) ArrayList(java.util.ArrayList) Period(com.artezio.arttime.datamodel.Period) CalendarUtils.createPeriod(com.artezio.arttime.test.utils.CalendarUtils.createPeriod) Test(org.junit.Test)

Aggregations

Employee (com.artezio.arttime.datamodel.Employee)201 Test (org.junit.Test)173 Project (com.artezio.arttime.datamodel.Project)121 HourType (com.artezio.arttime.datamodel.HourType)74 Hours (com.artezio.arttime.datamodel.Hours)65 Date (java.util.Date)39 BigDecimal (java.math.BigDecimal)33 Period (com.artezio.arttime.datamodel.Period)28 Filter (com.artezio.arttime.filter.Filter)23 ArrayList (java.util.ArrayList)20 PrepareForTest (org.powermock.core.classloader.annotations.PrepareForTest)19 CalendarUtils.getOffsetDate (com.artezio.arttime.test.utils.CalendarUtils.getOffsetDate)18 CalendarUtils.createPeriod (com.artezio.arttime.test.utils.CalendarUtils.createPeriod)15 TeamFilter (com.artezio.arttime.datamodel.TeamFilter)13 HashMap (java.util.HashMap)12 WorkdaysCalendar (com.artezio.arttime.datamodel.WorkdaysCalendar)7 Mail (com.artezio.arttime.services.mailing.Mail)7 ProjectRepository (com.artezio.arttime.services.repositories.ProjectRepository)7 List (java.util.List)7 Map (java.util.Map)7