use of com.artezio.arttime.datamodel.Project in project ART-TIME by Artezio.
the class ProjectEffortsSpreadSheetTest method testCreateRows_projectNotActiveAndHoursExists.
@Test
public void testCreateRows_projectNotActiveAndHoursExists() {
Project project = filter.getProjects().get(0);
project.setStatus(Project.Status.CLOSED);
expect(workTimeService.getEmployees(filter)).andReturn(project.getTeam());
replay(hoursRepository, projectRepository, workTimeService);
HoursIndexedBundle bundle = new HoursIndexedBundle(getHours());
List<SpreadSheetRow<?>> actual = spreadSheet.buildSpreadSheetRows(project, emptyList(), bundle);
assertEquals(5, actual.size());
}
use of com.artezio.arttime.datamodel.Project in project ART-TIME by Artezio.
the class ProjectEffortsSpreadSheetTest method testCreateRows_hoursExistsAndNoTeam.
@Test
public void testCreateRows_hoursExistsAndNoTeam() {
Project project = filter.getProjects().get(0);
HoursIndexedBundle bundle = new HoursIndexedBundle(getHours());
project.getTeam().clear();
expect(workTimeService.getEmployees(filter)).andReturn(filter.getEmployees());
replay(workTimeService);
List<SpreadSheetRow<?>> actual = spreadSheet.buildSpreadSheetRows(project, emptyList(), bundle);
assertEquals(5, actual.size());
}
use of com.artezio.arttime.datamodel.Project in project ART-TIME by Artezio.
the class ProjectEffortsSpreadSheetTest method testIsHighLevel_ifProjectInRowIsSubproject_AndMasterNotInFilter.
@Test
public void testIsHighLevel_ifProjectInRowIsSubproject_AndMasterNotInFilter() throws NoSuchFieldException {
Project master = new Project();
Project subproject = new Project(master);
setField(master, "id", 1L);
setField(subproject, "id", 2L);
HeadSpreadSheetRow row = new HeadSpreadSheetRow(subproject);
List<Project> projects = Arrays.asList(subproject);
spreadSheet.getFilter().setProjects(projects);
boolean actual = spreadSheet.isHighLevel(row);
assertTrue(actual);
}
use of com.artezio.arttime.datamodel.Project in project ART-TIME by Artezio.
the class ProjectEffortsSpreadSheetTest method testCalculateTotalKeysFor_masterProject.
@Test
public void testCalculateTotalKeysFor_masterProject() throws NoSuchFieldException {
Project master = new Project();
Project subproject = new Project(master);
setField(master, "id", 1L);
setField(subproject, "id", 2L);
// master head row
HeadSpreadSheetRow row1 = new HeadSpreadSheetRow(master);
// master hours
HoursSpreadSheetRow row2 = new HoursSpreadSheetRow(master, null, null, new ArrayList<>());
// master totals
TotalsSpreadSheetRow row3 = new TotalsSpreadSheetRow(master, null, Arrays.asList(row2));
// subproject head row
HeadSpreadSheetRow row4 = new HeadSpreadSheetRow(subproject);
// subproject hours
HoursSpreadSheetRow row5 = new HoursSpreadSheetRow(subproject, null, null, new ArrayList<>());
// subproject totals
TotalsSpreadSheetRow row6 = new TotalsSpreadSheetRow(subproject, null, Arrays.asList(row5));
// master and subproject totals
TotalsSpreadSheetRow row7 = new TotalsSpreadSheetRow(subproject, null, Arrays.asList(row2, row5));
List<SpreadSheetRow<?>> rows = Arrays.asList(row1, row2, row3, row4, row5, row6, row7);
setField(spreadSheet, "rows", rows);
List<Integer> expected = Arrays.asList(rows.get(2).getKey(), rows.get(6).getKey());
List<Integer> actual = spreadSheet.calculateKeysOfTotalsRows(row2);
assertEquals(2, actual.size());
ListAssert.assertEquals(expected, actual);
}
use of com.artezio.arttime.datamodel.Project in project ART-TIME by Artezio.
the class SpreadSheetTest method testGetSortedHourTypes_FilterHasNoHourTypes.
@Test
public void testGetSortedHourTypes_FilterHasNoHourTypes() throws NoSuchFieldException {
List<Employee> employees = new ArrayList<>();
List<HourType> hourTypes = buildHourTypeList(2);
HourType hourType = new HourType("1");
Project project = createProject("1", hourTypes, employees);
List<Hours> hours = buildHourList(project, employees, hourType, null);
setField(filter, "hourTypes", new ArrayList<>());
setField(spreadSheet, "filter", filter);
setField(spreadSheet, "hourTypeRepository", hourTypeRepository);
expect(hourTypeRepository.getAll()).andReturn(hourTypes);
replay(hourTypeRepository);
SortedSet<HourType> expected = new TreeSet<>(HourType.ACTUALTIME_TYPE_COMPARATOR);
expected.addAll(hourTypes);
SortedSet<HourType> actual = spreadSheet.getSortedHourTypes(project, hours);
assertEquals(expected, actual);
}
Aggregations