use of com.artezio.arttime.datamodel.Employee in project ART-TIME by Artezio.
the class ProjectEffortsSpreadSheetTest method testHasTeam_EmployeeNotInFilter.
@Test
public void testHasTeam_EmployeeNotInFilter() throws NoSuchFieldException {
Employee employee = new Employee("employee");
spreadSheet.getFilter().setEmployees(emptyList());
Project master = createProject("master", emptyList(), asList(employee));
Project subproject = createProject("subproject", emptyList(), asList(employee));
setField(subproject, "master", master);
assertFalse(spreadSheet.hasTeam(master, asList(subproject)));
}
use of com.artezio.arttime.datamodel.Employee in project ART-TIME by Artezio.
the class LoginBeanTest method testGetLoggedEmployee_ifNull_AndExternalContextIsNull.
@Test
public void testGetLoggedEmployee_ifNull_AndExternalContextIsNull() throws Exception {
setField(loginBean, "loggedEmployee", null);
setField(loginBean, "externalContext", null);
Employee actual = loginBean.getLoggedEmployee();
assertNull(actual);
}
use of com.artezio.arttime.datamodel.Employee in project ART-TIME by Artezio.
the class LoginBeanTest method testGetLoggedEmployee_ifNull.
@Test
public void testGetLoggedEmployee_ifNull() throws Exception {
setField(loginBean, "loggedEmployee", null);
setField(loginBean, "externalContext", externalContext);
setField(loginBean, "employeeRepository", employeeRepository);
Employee employee = new Employee();
Principal principal = createMock(Principal.class);
expect(externalContext.getUserPrincipal()).andReturn(principal);
expect(principal.getName()).andReturn("iivanov");
expect(employeeRepository.find("iivanov")).andReturn(employee);
replay(externalContext, employeeRepository, principal);
Employee actual = loginBean.getLoggedEmployee();
verify(externalContext, employeeRepository, principal);
assertNotNull(actual);
}
use of com.artezio.arttime.datamodel.Employee in project ART-TIME by Artezio.
the class LoginBeanTest method testGetLoggedEmployee_ifNullAndNotFoundInRepository.
@Test
public void testGetLoggedEmployee_ifNullAndNotFoundInRepository() throws Exception {
setField(loginBean, "loggedEmployee", null);
setField(loginBean, "externalContext", externalContext);
setField(loginBean, "employeeRepository", employeeRepository);
Principal principal = createMock(Principal.class);
expect(externalContext.getUserPrincipal()).andReturn(principal);
expect(principal.getName()).andReturn("iivanov");
expect(employeeRepository.find("iivanov")).andReturn(null);
replay(externalContext, employeeRepository, principal);
Employee actual = loginBean.getLoggedEmployee();
verify(externalContext, employeeRepository, principal);
assertNotNull(actual);
assertEquals("iivanov", actual.getUserName());
}
use of com.artezio.arttime.datamodel.Employee in project ART-TIME by Artezio.
the class ProjectBeanTest method testChangeRecordWithArrayValueToListValueInParticipations_allRemoved_expectClear.
@Test
public void testChangeRecordWithArrayValueToListValueInParticipations_allRemoved_expectClear() throws NoSuchFieldException {
Map<Employee, Project[]> participations = new HashMap<>();
Employee employee = new Employee("empl");
Project oldProject = new Project();
setField(oldProject, "id", 33L);
oldProject.addTeamMember(employee);
Project oldProject2 = new Project();
oldProject2.addTeamMember(employee);
setField(oldProject2, "id", 44L);
participations.put(employee, new Project[] {});
setField(bean, "participations", participations);
setField(bean, "projects", Arrays.asList(oldProject, oldProject2));
List<Project> newParticipations = Collections.emptyList();
bean.changeRecordWithArrayValueToListValueInParticipations(employee, newParticipations);
assertTrue(bean.getParticipations().containsKey(employee));
List<Project> actualParticipations = bean.getParticipations().get(employee);
assertFalse(actualParticipations.contains(oldProject2));
assertFalse(actualParticipations.contains(oldProject));
assertFalse(oldProject.isTeamMember(employee));
assertFalse(oldProject2.isTeamMember(employee));
}
Aggregations