use of com.artezio.arttime.services.NotificationManager.SubordinateProblem 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<Date, BigDecimal>();
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);
SubordinateProblem subordinateProblem = notificationManager.new SubordinateProblem(employee, approvedWorkTimeProblems);
Object[] expected = new Object[] { new AbstractMap.SimpleEntry<Date, BigDecimal>(sdf.parse("1-01-2015"), BigDecimal.ONE), new AbstractMap.SimpleEntry<Date, BigDecimal>(sdf.parse("2-01-2015"), BigDecimal.TEN), new AbstractMap.SimpleEntry<Date, BigDecimal>(sdf.parse("3-01-2015"), BigDecimal.ZERO) };
Object[] actual = subordinateProblem.getDeviationDetails();
assertEquals(expected, actual);
}
use of com.artezio.arttime.services.NotificationManager.SubordinateProblem 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<Employee, Map<Date, BigDecimal>>();
timeProblems.put(employee1, new HashMap<Date, BigDecimal>());
timeProblems.put(employee2, new HashMap<Date, BigDecimal>());
timeProblems.put(employee3, new HashMap<Date, BigDecimal>());
Set<SubordinateProblem> actual = notificationManager.getSubordinateProblems(employee1, projects, timeProblems);
assertEquals(1, actual.size());
assertEquals(employee2, actual.iterator().next().getEmployee());
}
use of com.artezio.arttime.services.NotificationManager.SubordinateProblem 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<Date, BigDecimal>();
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);
SubordinateProblem subordinateProblem = notificationManager.new SubordinateProblem(employee, approvedWorkTimeProblems);
BigDecimal actual = subordinateProblem.getDeviation();
assertEquals(new BigDecimal(11), actual);
}
use of com.artezio.arttime.services.NotificationManager.SubordinateProblem 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");
SubordinateProblem subordinate1 = notificationManager.new SubordinateProblem(employee1, new HashMap<Date, BigDecimal>());
SubordinateProblem subordinate2 = notificationManager.new SubordinateProblem(employee2, new HashMap<Date, BigDecimal>());
SubordinateProblem subordinate3 = notificationManager.new SubordinateProblem(employee3, new HashMap<Date, BigDecimal>());
List<SubordinateProblem> subordinates = Arrays.asList(subordinate1, subordinate2, subordinate3);
String expected = "iivanov,ppetrov,asidorov";
String actual = notificationManager.getSubordinatesAsString(subordinates);
assertEquals(expected, actual);
}
Aggregations