Search in sources :

Example 6 with SpreadSheet

use of com.artezio.arttime.web.spread_sheet.SpreadSheet in project ART-TIME by Artezio.

the class ManageEffortsBeanTest method testInitEmployeeEffortsSpreadSheet.

@Test
public void testInitEmployeeEffortsSpreadSheet() throws Exception {
    manageEffortsBean = new ManageEffortsBean();
    EmployeeService employeeService = mock(EmployeeService.class);
    EmployeeEffortsSpreadSheetBuildingStrategy strategy = createMock(EmployeeEffortsSpreadSheetBuildingStrategy.class);
    setField(strategy, "employeeService", employeeService);
    Filter filter = createMock(Filter.class);
    setField(manageEffortsBean, "grouping", BY_EMPLOYEES);
    setField(manageEffortsBean, "filterBean", filterBean);
    setField(manageEffortsBean, "employeeService", employeeService);
    expect(employeeService.getEffortsEmployees()).andReturn(Collections.emptyList());
    EasyMock.expect(filterBean.getCurrentFilter()).andReturn(filter);
    replay(employeeService, filterBean, strategy);
    SpreadSheet actual = manageEffortsBean.initSpreadSheet();
    verify(employeeService, filterBean, strategy);
    assertEquals(EmployeeEffortsSpreadSheet.class, actual.getClass());
}
Also used : EmployeeEffortsSpreadSheetBuildingStrategy(com.artezio.arttime.web.spread_sheet.strategies.EmployeeEffortsSpreadSheetBuildingStrategy) Filter(com.artezio.arttime.filter.Filter) SpreadSheet(com.artezio.arttime.web.spread_sheet.SpreadSheet) EmployeeEffortsSpreadSheet(com.artezio.arttime.web.spread_sheet.EmployeeEffortsSpreadSheet) ProjectEffortsSpreadSheet(com.artezio.arttime.web.spread_sheet.ProjectEffortsSpreadSheet) EmployeeService(com.artezio.arttime.services.EmployeeService) PrepareForTest(org.powermock.core.classloader.annotations.PrepareForTest) Test(org.junit.Test)

Example 7 with SpreadSheet

use of com.artezio.arttime.web.spread_sheet.SpreadSheet in project ART-TIME by Artezio.

the class ManageEffortsBeanTest method testGetSpreadSheet_ifNotNull.

@Test
public void testGetSpreadSheet_ifNotNull() throws Exception {
    SpreadSheet actual = manageEffortsBean.getSpreadSheet();
    assertSame(spreadSheet, actual);
}
Also used : SpreadSheet(com.artezio.arttime.web.spread_sheet.SpreadSheet) EmployeeEffortsSpreadSheet(com.artezio.arttime.web.spread_sheet.EmployeeEffortsSpreadSheet) ProjectEffortsSpreadSheet(com.artezio.arttime.web.spread_sheet.ProjectEffortsSpreadSheet) PrepareForTest(org.powermock.core.classloader.annotations.PrepareForTest) Test(org.junit.Test)

Example 8 with SpreadSheet

use of com.artezio.arttime.web.spread_sheet.SpreadSheet in project ART-TIME by Artezio.

the class ManageEffortsBeanTest method testShowMasterProjectTotalsLabel_ifGroupingByProject_AndNotShow.

@Test
public void testShowMasterProjectTotalsLabel_ifGroupingByProject_AndNotShow() throws NoSuchFieldException {
    Project project = new Project();
    Sheet sheet = createMock(Sheet.class);
    SpreadSheet spreadSheet = createMock(SpreadSheet.class);
    HeadSpreadSheetRow row1 = new HeadSpreadSheetRow(project);
    HeadSpreadSheetRow row2 = new HeadSpreadSheetRow(project);
    setField(manageEffortsBean, "grouping", BY_PROJECTS);
    setField(project, "id", 1L);
    setField(manageEffortsBean, "spreadSheet", spreadSheet);
    expect(spreadSheet.getSheet()).andReturn(sheet);
    expect(sheet.getRowIndex()).andReturn(1);
    expect(spreadSheet.getRows()).andReturn(Arrays.asList(row1, row2));
    replay(spreadSheet, sheet);
    boolean actual = manageEffortsBean.showMasterProjectTotalsLabel(row2);
    verify(spreadSheet, sheet);
    assertFalse(actual);
}
Also used : Project(com.artezio.arttime.datamodel.Project) HeadSpreadSheetRow(com.artezio.arttime.web.spread_sheet.HeadSpreadSheetRow) SpreadSheet(com.artezio.arttime.web.spread_sheet.SpreadSheet) EmployeeEffortsSpreadSheet(com.artezio.arttime.web.spread_sheet.EmployeeEffortsSpreadSheet) ProjectEffortsSpreadSheet(com.artezio.arttime.web.spread_sheet.ProjectEffortsSpreadSheet) SpreadSheet(com.artezio.arttime.web.spread_sheet.SpreadSheet) EmployeeEffortsSpreadSheet(com.artezio.arttime.web.spread_sheet.EmployeeEffortsSpreadSheet) ProjectEffortsSpreadSheet(com.artezio.arttime.web.spread_sheet.ProjectEffortsSpreadSheet) Sheet(com.lassitercg.faces.components.sheet.Sheet) PrepareForTest(org.powermock.core.classloader.annotations.PrepareForTest) Test(org.junit.Test)

Example 9 with SpreadSheet

use of com.artezio.arttime.web.spread_sheet.SpreadSheet in project ART-TIME by Artezio.

the class TimesheetBeanTest method testGetSpreadSheet_ifNull.

@Test
public void testGetSpreadSheet_ifNull() {
    Filter currentFilter = createMock(Filter.class);
    Filter personalTimesheetFilter = createMock(Filter.class);
    expect(employeeService.getLoggedEmployee()).andReturn(Optional.of(new Employee()));
    expect(filterService.getTimesheetFilter()).andReturn(personalTimesheetFilter);
    expect(filterBean.getCurrentFilter()).andReturn(currentFilter);
    replay(filterBean, filterService, employeeService);
    SpreadSheet actual = bean.getSpreadSheet();
    verify(filterBean, filterService, employeeService);
    assertNotNull(actual);
}
Also used : Employee(com.artezio.arttime.datamodel.Employee) Filter(com.artezio.arttime.filter.Filter) SpreadSheet(com.artezio.arttime.web.spread_sheet.SpreadSheet) Test(org.junit.Test)

Aggregations

SpreadSheet (com.artezio.arttime.web.spread_sheet.SpreadSheet)9 Test (org.junit.Test)9 PrepareForTest (org.powermock.core.classloader.annotations.PrepareForTest)7 EmployeeEffortsSpreadSheet (com.artezio.arttime.web.spread_sheet.EmployeeEffortsSpreadSheet)5 ProjectEffortsSpreadSheet (com.artezio.arttime.web.spread_sheet.ProjectEffortsSpreadSheet)5 Filter (com.artezio.arttime.filter.Filter)3 Project (com.artezio.arttime.datamodel.Project)2 EmployeeService (com.artezio.arttime.services.EmployeeService)2 HeadSpreadSheetRow (com.artezio.arttime.web.spread_sheet.HeadSpreadSheetRow)2 Sheet (com.lassitercg.faces.components.sheet.Sheet)2 Employee (com.artezio.arttime.datamodel.Employee)1 EmployeeEffortsSpreadSheetBuildingStrategy (com.artezio.arttime.web.spread_sheet.strategies.EmployeeEffortsSpreadSheetBuildingStrategy)1 ProjectEffortsSpreadSheetBuildingStrategy (com.artezio.arttime.web.spread_sheet.strategies.ProjectEffortsSpreadSheetBuildingStrategy)1