use of com.artezio.arttime.datamodel.Employee in project ART-TIME by Artezio.
the class TeamSynchronizerTest method testImportTeam_ShouldNotSendEmptyNotification.
@Test
public void testImportTeam_ShouldNotSendEmptyNotification() throws MessagingException {
Project project = new Project();
List<Employee> newMembers = Collections.emptyList();
List<Employee> newTeamMembers = Collections.emptyList();
expect(projectRepository.fetchComplete(project)).andReturn(project);
expect(projectService.getSubprojectsByProject(project)).andReturn(new ArrayList<>());
expect(teamTrackingSystem.getTeam(project)).andReturn(newMembers);
expect(projectService.addTeamMembers(project, newMembers)).andReturn(newTeamMembers);
replay(projectRepository, projectService, teamTrackingSystem, mailingEngine, mailTemplateManager);
teamSynchronizer.importTeam(project);
verify(projectRepository, projectService, teamTrackingSystem, mailingEngine, mailTemplateManager);
}
use of com.artezio.arttime.datamodel.Employee in project ART-TIME by Artezio.
the class LdapAdapterTest method testFindEmployeesByFullName.
@Test
public void testFindEmployeesByFullName() {
Employee employee1 = new Employee("jsmith", "John", "Smith", "j_smith@mail.com");
Employee employee2 = new Employee("bgray", "Bob", "Gray", "b_gray@mail.com");
List<Employee> employees = new ArrayList<Employee>(Arrays.asList(employee1, employee2));
ldapImpl = EasyMock.createMockBuilder(LdapAdapter.class).addMockedMethod("getEmployees").createMock();
EasyMock.expect(ldapImpl.getEmployees()).andReturn(employees);
EasyMock.replay(ldapImpl);
List<Employee> actual = ldapImpl.findEmployeesByFullName("smi");
assertEquals(1, actual.size());
assertEquals(employee1, actual.get(0));
}
use of com.artezio.arttime.datamodel.Employee in project ART-TIME by Artezio.
the class LdapAdapterTest method testFindEmployeesByFullName_SearchNameIsEmpty.
@Test
public void testFindEmployeesByFullName_SearchNameIsEmpty() {
Employee employee1 = new Employee("jsmith", "John", "Smith", "j_smith@mail.com");
Employee employee2 = new Employee("bgray", "Bob", "Gray", "b_gray@mail.com");
List<Employee> expected = new ArrayList<Employee>(Arrays.asList(employee1, employee2));
ldapImpl = EasyMock.createMockBuilder(LdapAdapter.class).addMockedMethod("getEmployees").createMock();
EasyMock.expect(ldapImpl.getEmployees()).andReturn(expected);
EasyMock.replay(ldapImpl);
List<Employee> actual = ldapImpl.findEmployeesByFullName("");
assertThat(actual, is(expected));
}
use of com.artezio.arttime.datamodel.Employee in project ART-TIME by Artezio.
the class LdapAdapterTest method testGetTeam_TwoTeamCodes.
@Test
public void testGetTeam_TwoTeamCodes() throws Exception {
Logger log = createMock(Logger.class);
setField(ldapImpl, "log", log);
Project project = new Project();
TeamFilter teamFilter = new TeamFilter(FilterType.PROJECT_CODES, "_ART-PRJ-ART-TIME-PG,_ART-PRJ-ART-TIME-PM");
project.setTeamFilter(teamFilter);
setField(ldapImpl, "workdaysCalendarRepository", workdaysCalendarRepository);
expect(workdaysCalendarRepository.findDefaultCalendar(anyObject(Employee.class))).andReturn(null).anyTimes();
replay(workdaysCalendarRepository);
List<Employee> team = ldapImpl.getTeam(project);
verify(workdaysCalendarRepository);
assertTrue(team.size() > 0);
}
use of com.artezio.arttime.datamodel.Employee in project ART-TIME by Artezio.
the class LdapAdapterTest method testFindEmployee_SearchMustBeCaseInsensitive.
@Test
public void testFindEmployee_SearchMustBeCaseInsensitive() throws NoSuchFieldException {
setField(ldapImpl, "workdaysCalendarRepository", workdaysCalendarRepository);
expect(workdaysCalendarRepository.findDefaultCalendar(anyObject(Employee.class))).andReturn(null).anyTimes();
replay(workdaysCalendarRepository);
Employee employee = ldapImpl.findEmployee("Sdegtyarev");
verify(workdaysCalendarRepository);
assertNotNull(employee);
assertEquals("sdegtyarev", employee.getUserName());
}
Aggregations