use of com.artezio.arttime.datamodel.HourType in project ART-TIME by Artezio.
the class HoursIndexedBundleTest method testContainsHours_ByProjectAndEmployee_ifContainsOnlyEmployee.
@Test
public void testContainsHours_ByProjectAndEmployee_ifContainsOnlyEmployee() {
Project project1 = createProject(1L);
Project project2 = createProject(2L);
Employee employee = new Employee("employee");
HourType hourType = new HourType();
Hours hour = new Hours(project1, new Date(), employee, hourType);
List<Hours> hours = Arrays.asList(hour);
bundle = createHoursIndexedBundle(hours);
boolean actual = bundle.containsHours(project2, employee);
assertFalse(actual);
}
use of com.artezio.arttime.datamodel.HourType in project ART-TIME by Artezio.
the class HoursIndexedBundleTest method testFindHours_ByProjectAndEmployee_NoHours.
@Test
public void testFindHours_ByProjectAndEmployee_NoHours() {
Project project1 = createProject(1L);
Project project2 = createProject(2L);
Employee employee1 = new Employee("employee1");
Employee employee2 = new Employee("employee2");
Employee employee3 = new Employee("employee3");
HourType type1 = new HourType("regular");
Hours hours1 = createHours(project1, employee1, type1);
Hours hours2 = createHours(project1, employee2, type1);
bundle = createHoursIndexedBundle(Arrays.asList(hours1, hours2));
assertTrue(bundle.findHours(project2, employee1).isEmpty());
assertTrue(bundle.findHours(project1, employee3).isEmpty());
}
use of com.artezio.arttime.datamodel.HourType in project ART-TIME by Artezio.
the class HoursIndexedBundleTest method testFindHours_ByProjectAndEmployee.
@Test
public void testFindHours_ByProjectAndEmployee() {
Project project1 = createProject(1L);
Project project2 = createProject(2L);
Employee employee1 = new Employee("employee1");
Employee employee2 = new Employee("employee2");
HourType type1 = new HourType("regular");
HourType type2 = new HourType("overtime");
Hours hours1 = createHours(project1, employee1, type1);
Hours hours2 = createHours(project2, employee1, type2);
Hours hours3 = createHours(project1, employee2, type1);
bundle = createHoursIndexedBundle(Arrays.asList(hours1, hours2, hours3));
List<Hours> actual = bundle.findHours(project1, employee1);
ListAssert.assertEquals(Arrays.asList(hours1), actual);
}
use of com.artezio.arttime.datamodel.HourType in project ART-TIME by Artezio.
the class HoursSpreadSheetRowTest method testGetRowTotal.
@Test
public void testGetRowTotal() throws Exception {
Project project = new Project();
Employee employee = new Employee();
HourType hourType = new HourType();
Date date1 = sdf.parse("1-01-2014");
Date date2 = sdf.parse("2-01-2014");
Date date3 = sdf.parse("3-01-2014");
Date date4 = sdf.parse("4-01-2014");
Hours hour1 = new Hours(project, date1, employee, hourType);
hour1.setQuantity(BigDecimal.ONE);
Hours hour2 = new Hours(project, date2, employee, hourType);
hour2.setQuantity(BigDecimal.TEN);
List<Hours> hours = Arrays.asList(hour1, hour2);
row = new HoursSpreadSheetRow(project, employee, hourType, hours);
row.getValuesMap().put(date3, new Hours(project, date3, employee, hourType));
row.getValuesMap().put(date4, null);
BigDecimal actual = row.getRowTotal();
assertEquals(new BigDecimal("11"), actual);
}
use of com.artezio.arttime.datamodel.HourType in project ART-TIME by Artezio.
the class HoursSpreadSheetRowTest method testGet_ifNotContainsValue.
@Test
public void testGet_ifNotContainsValue() throws Exception {
Employee employee = new Employee();
HourType hourType = new HourType();
Date date = sdf.parse("1-01-2014");
Project project = new Project();
row = new HoursSpreadSheetRow(project, employee, hourType, new ArrayList<>());
Hours actual = row.get(date);
assertNull(actual.getQuantity());
}
Aggregations