Search in sources :

Example 1 with HeadSpreadSheetRow

use of com.artezio.arttime.web.spread_sheet.HeadSpreadSheetRow 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 2 with HeadSpreadSheetRow

use of com.artezio.arttime.web.spread_sheet.HeadSpreadSheetRow 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)

Aggregations

Project (com.artezio.arttime.datamodel.Project)2 EmployeeEffortsSpreadSheet (com.artezio.arttime.web.spread_sheet.EmployeeEffortsSpreadSheet)2 HeadSpreadSheetRow (com.artezio.arttime.web.spread_sheet.HeadSpreadSheetRow)2 ProjectEffortsSpreadSheet (com.artezio.arttime.web.spread_sheet.ProjectEffortsSpreadSheet)2 SpreadSheet (com.artezio.arttime.web.spread_sheet.SpreadSheet)2 Sheet (com.lassitercg.faces.components.sheet.Sheet)2 Test (org.junit.Test)2 PrepareForTest (org.powermock.core.classloader.annotations.PrepareForTest)2