Search in sources :

Example 1 with SpreadSheet

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

the class TimesheetBeanTest method testGetSpreadSheet_ifNotNull.

@Test
public void testGetSpreadSheet_ifNotNull() throws ReflectiveOperationException {
    setField(bean, "spreadSheet", spreadSheet);
    SpreadSheet actual = bean.getSpreadSheet();
    assertSame(spreadSheet, actual);
}
Also used : SpreadSheet(com.artezio.arttime.web.spread_sheet.SpreadSheet) Test(org.junit.Test)

Example 2 with SpreadSheet

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

the class ManageEffortsBeanTest method testShowMasterProjectTotalsLabel_ifGroupingByProject_AndShow.

@Test
public void testShowMasterProjectTotalsLabel_ifGroupingByProject_AndShow() throws NoSuchFieldException {
    Project project1 = new Project();
    Project project2 = new Project();
    Sheet sheet = createMock(Sheet.class);
    SpreadSheet spreadSheet = createMock(SpreadSheet.class);
    HeadSpreadSheetRow row1 = new HeadSpreadSheetRow(project1);
    HeadSpreadSheetRow row2 = new HeadSpreadSheetRow(project2);
    setField(project1, "id", 1L);
    setField(project2, "id", 2L);
    setField(manageEffortsBean, "grouping", BY_PROJECTS);
    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);
    assertTrue(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 3 with SpreadSheet

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

the class EffortsBeanTest method testGetSpreadSheet_ifNull.

@Test
public void testGetSpreadSheet_ifNull() throws Exception {
    effortsBean = createMockBuilder(EffortsBean.class).addMockedMethod("initSpreadSheet").createMock();
    setField(effortsBean, "spreadSheet", null);
    SpreadSheet spreadSheet = createMock(SpreadSheet.class);
    expect(effortsBean.initSpreadSheet()).andReturn(spreadSheet);
    replay(effortsBean);
    SpreadSheet actual = effortsBean.getSpreadSheet();
    verify(effortsBean);
    assertSame(spreadSheet, actual);
}
Also used : SpreadSheet(com.artezio.arttime.web.spread_sheet.SpreadSheet) PrepareForTest(org.powermock.core.classloader.annotations.PrepareForTest) Test(org.junit.Test)

Example 4 with SpreadSheet

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

the class EffortsBeanTest method testGetSpreadSheet_ifNotNull.

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

Example 5 with SpreadSheet

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

the class ManageEffortsBeanTest method testInitProjectEffortsSpreadSheet.

@Test
public void testInitProjectEffortsSpreadSheet() throws Exception {
    manageEffortsBean = new ManageEffortsBean();
    ProjectEffortsSpreadSheetBuildingStrategy strategy = createMock(ProjectEffortsSpreadSheetBuildingStrategy.class);
    EmployeeService employeeService = mock(EmployeeService.class);
    setField(strategy, "employeeService", employeeService);
    Filter filter = createMock(Filter.class);
    setField(manageEffortsBean, "grouping", BY_PROJECTS);
    setField(manageEffortsBean, "filterBean", filterBean);
    setField(manageEffortsBean, "employeeService", employeeService);
    EasyMock.expect(filterService.getActiveProjectsFilter()).andReturn(filter);
    EasyMock.expect(filterBean.getCurrentFilter()).andReturn(filter);
    expect(employeeService.getEffortsEmployees()).andReturn(Collections.emptyList());
    replay(employeeService, filterBean, strategy);
    SpreadSheet actual = manageEffortsBean.initSpreadSheet();
    verify(employeeService, filterBean, strategy);
    assertEquals(ProjectEffortsSpreadSheet.class, actual.getClass());
}
Also used : 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) ProjectEffortsSpreadSheetBuildingStrategy(com.artezio.arttime.web.spread_sheet.strategies.ProjectEffortsSpreadSheetBuildingStrategy) EmployeeService(com.artezio.arttime.services.EmployeeService) PrepareForTest(org.powermock.core.classloader.annotations.PrepareForTest) 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