use of com.artezio.arttime.datamodel.WorkdaysCalendar in project ART-TIME by Artezio.
the class ProjectRepositoryTest method testCreateProjectWithSameEmployee.
@Test
public void testCreateProjectWithSameEmployee() throws NoSuchFieldException {
Employee employee = new Employee("slave");
WorkdaysCalendar calendar = new WorkdaysCalendar("calendar");
entityManager.merge(employee);
entityManager.persist(calendar);
entityManager.flush();
entityManager.clear();
Employee manager = new Employee("manager");
employee.setCalendar(calendar);
Project project = new Project();
project.addManager(manager);
project.addTeamMember(employee);
setField(projectRepository, "employeeRepository", employeeRepository);
expect(employeeRepository.create(employee)).andReturn(employee);
expect(employeeRepository.create(manager)).andReturn(getPersisted(manager));
replay(employeeRepository);
projectRepository.create(project);
verify(employeeRepository);
}
use of com.artezio.arttime.datamodel.WorkdaysCalendar in project ART-TIME by Artezio.
the class WorkdaysCalendarRepositoryTest method testFindByDepartment_notExists.
@Test
public void testFindByDepartment_notExists() {
WorkdaysCalendar actual = workdaysCalendarRepository.findByDepartment("dep1");
assertNull(actual);
}
use of com.artezio.arttime.datamodel.WorkdaysCalendar in project ART-TIME by Artezio.
the class WorkdaysCalendarRepositoryTest method testCreateOrUpdateDays_Create.
@Test
public void testCreateOrUpdateDays_Create() {
WorkdaysCalendar workdaysCalendar = new WorkdaysCalendar("calendarTtestCreateOrUpdateDays_Create");
entityManager.persist(workdaysCalendar);
Day expected = new Day(new Date(), workdaysCalendar);
workdaysCalendarRepository.update(Arrays.asList(expected));
assertNotNull(expected.getId());
Day actual = entityManager.find(Day.class, expected.getId());
assertEquals(expected, actual);
}
use of com.artezio.arttime.datamodel.WorkdaysCalendar in project ART-TIME by Artezio.
the class WorkdaysCalendarRepositoryTest method testCreateWorkdaysCalendar.
@Test
public void testCreateWorkdaysCalendar() throws NoSuchFieldException {
WorkdaysCalendar expected = new WorkdaysCalendar("expected calendar");
WorkdaysCalendar actual = workdaysCalendarRepository.create(expected);
assertSame(expected, actual);
}
use of com.artezio.arttime.datamodel.WorkdaysCalendar in project ART-TIME by Artezio.
the class WorkdaysCalendarRepositoryTest method testUpdate.
@Test
public void testUpdate() {
WorkdaysCalendar calendar = new WorkdaysCalendar("WDCal");
entityManager.persist(calendar);
entityManager.flush();
String newName = "NewName";
calendar.setName(newName);
WorkdaysCalendar actual = workdaysCalendarRepository.update(calendar);
assertEquals(newName, actual.getName());
}
Aggregations