use of com.artezio.arttime.services.NotificationManager.WorkTimeProblems in project ART-TIME by Artezio.
the class NotificationManagerTest method testGetSubordinateProblems.
@Test
public void testGetSubordinateProblems() throws Exception {
Employee employee1 = createEmployee("iivanov", "Ivan", "Ivanov");
Employee employee2 = createEmployee("ppetrov", "Petr", "Petrov");
Employee employee3 = createEmployee("asidorov", "Andrey", "Sidorov");
Project project1 = createProject(1L, employee2);
Project project2 = createProject(2L, employee3, employee1);
project1.addManager(employee1);
project2.addManager(employee2);
List<Project> projects = Arrays.asList(project1, project2);
Map<Employee, Map<Date, BigDecimal>> timeProblems = new HashMap<>();
timeProblems.put(employee1, new HashMap<>());
timeProblems.put(employee2, new HashMap<>());
timeProblems.put(employee3, new HashMap<>());
Set<WorkTimeProblems> actual = notificationManager.getEmployeeWorktimeProblems(employee1, projects, timeProblems);
assertEquals(1, actual.size());
assertEquals(employee2, actual.iterator().next().getEmployee());
}
use of com.artezio.arttime.services.NotificationManager.WorkTimeProblems in project ART-TIME by Artezio.
the class NotificationManagerTest method testSubordinateGetDeviationDetails.
@Test
public void testSubordinateGetDeviationDetails() throws Exception {
Employee employee = createEmployee("iivanov", "Ivan", "Ivanov");
SimpleDateFormat sdf = new SimpleDateFormat("dd-MM-yyyy");
Map<Date, BigDecimal> approvedWorkTimeProblems = new TreeMap<>();
approvedWorkTimeProblems.put(sdf.parse("1-01-2015"), BigDecimal.ONE);
approvedWorkTimeProblems.put(sdf.parse("2-01-2015"), BigDecimal.TEN);
approvedWorkTimeProblems.put(sdf.parse("3-01-2015"), BigDecimal.ZERO);
WorkTimeProblems subordinateProblem = notificationManager.new WorkTimeProblems(employee, approvedWorkTimeProblems);
Object[] expected = new Object[] { new AbstractMap.SimpleEntry<>(sdf.parse("1-01-2015"), BigDecimal.ONE), new AbstractMap.SimpleEntry<>(sdf.parse("2-01-2015"), BigDecimal.TEN), new AbstractMap.SimpleEntry<>(sdf.parse("3-01-2015"), BigDecimal.ZERO) };
Object[] actual = subordinateProblem.getDeviationDetails();
// TODO use assertArrayEquals
assertEquals(expected, actual);
}
use of com.artezio.arttime.services.NotificationManager.WorkTimeProblems in project ART-TIME by Artezio.
the class NotificationManagerTest method testGetSubordinatesAsString.
@Test
public void testGetSubordinatesAsString() {
Employee employee1 = createEmployee("iivanov", "Ivan", "Ivanov");
Employee employee2 = createEmployee("ppetrov", "Petr", "Petrov");
Employee employee3 = createEmployee("asidorov", "Andrey", "Sidorov");
WorkTimeProblems subordinate1 = notificationManager.new WorkTimeProblems(employee1, new HashMap<>());
WorkTimeProblems subordinate2 = notificationManager.new WorkTimeProblems(employee2, new HashMap<>());
WorkTimeProblems subordinate3 = notificationManager.new WorkTimeProblems(employee3, new HashMap<>());
List<WorkTimeProblems> subordinates = Arrays.asList(subordinate1, subordinate2, subordinate3);
String expected = "iivanov,ppetrov,asidorov";
String actual = notificationManager.getEmployeesAsString(subordinates);
assertEquals(expected, actual);
}
use of com.artezio.arttime.services.NotificationManager.WorkTimeProblems in project ART-TIME by Artezio.
the class NotificationManagerTest method testSubordinateGetDeviation.
@Test
public void testSubordinateGetDeviation() throws Exception {
Employee employee = createEmployee("iivanov", "Ivan", "Ivanov");
SimpleDateFormat sdf = new SimpleDateFormat("dd-MM-yyyy");
Map<Date, BigDecimal> approvedWorkTimeProblems = new HashMap<>();
approvedWorkTimeProblems.put(sdf.parse("1-01-2015"), BigDecimal.ONE);
approvedWorkTimeProblems.put(sdf.parse("2-01-2015"), BigDecimal.TEN);
approvedWorkTimeProblems.put(sdf.parse("3-01-2015"), BigDecimal.ZERO);
WorkTimeProblems subordinateProblem = notificationManager.new WorkTimeProblems(employee, approvedWorkTimeProblems);
BigDecimal actual = subordinateProblem.getDeviation();
assertEquals(new BigDecimal(11), actual);
}
Aggregations