use of com.artezio.arttime.filter.Filter in project ART-TIME by Artezio.
the class ReportedHoursIndicatorTest method testGetFilter.
@Test
public void testGetFilter() {
hoursIndicator = new ReportedHoursIndicator();
FacesContext facesContext = createMock(FacesContext.class);
Application application = createMock(Application.class);
FilterBean filterBean = createMock(FilterBean.class);
Filter filter = new Filter();
PowerMock.mockStatic(FacesContext.class);
expect(FacesContext.getCurrentInstance()).andReturn(facesContext);
expect(facesContext.getApplication()).andReturn(application);
expect(application.evaluateExpressionGet(facesContext, "#{filterBean}", Object.class)).andReturn(filterBean);
expect(filterBean.getCurrentFilter()).andReturn(filter);
PowerMock.replayAll(FacesContext.class, facesContext, application, filterBean);
Filter actual = hoursIndicator.getFilter();
PowerMock.verifyAll();
assertSame(filter, actual);
}
use of com.artezio.arttime.filter.Filter in project ART-TIME by Artezio.
the class SpreadSheetTest method setUp.
@Before
public void setUp() throws NoSuchFieldException, ParseException {
filter = new Filter();
createEmployees();
spreadSheet = new SpreadSheet() {
@Override
protected List<SpreadSheetRow<?>> buildSpreadSheetRows() {
return null;
}
@Override
protected List<Integer> calculateKeysOfTotalsRows(SpreadSheetRow<?> updatedRow) {
return null;
}
};
setField(spreadSheet, "filter", filter);
setField(spreadSheet, "availableEmployees", employees);
}
use of com.artezio.arttime.filter.Filter in project ART-TIME by Artezio.
the class ManageEffortsBeanTest method testRequestReport.
@Test
public void testRequestReport() throws Exception {
Filter filter = new Filter();
Employee employee = new Employee();
PowerMock.mockStatic(Faces.class);
expect(Faces.getRequestParameter("recipientEmail")).andReturn("iivanov@mail.com");
expect(filterBean.getCurrentFilter()).andReturn(filter);
notificationManager.requestWorkTimeReport("iivanov@mail.com", filter.getPeriod());
PowerMock.replayAll(Faces.class, filterBean, notificationManager);
manageEffortsBean.requestReport();
PowerMock.verifyAll();
}
use of com.artezio.arttime.filter.Filter in project ART-TIME by Artezio.
the class ReportsBeanTest method testGetSelectedEmployeeUserNames_emptyParam.
@Test
public void testGetSelectedEmployeeUserNames_emptyParam() {
List<Employee> employees = asList(new Employee("username1"), new Employee("username2"));
Filter filter = new Filter();
filter.setEmployees(Collections.emptyList());
expect(employeeService.getEffortsEmployees(filter)).andReturn(employees);
expect(filterBean.getCurrentFilter()).andReturn(filter).anyTimes();
replay(filterBean, employeeService);
String[] actual = reportsBean.getSelectedEmployeeUserNames();
verify(filterBean, employeeService);
Assert.assertArrayEquals(new String[] { "username1", "username2" }, actual);
}
use of com.artezio.arttime.filter.Filter in project ART-TIME by Artezio.
the class ReportsBeanTest method testGetSelectedProjectIds.
@Test
public void testGetSelectedProjectIds() throws NoSuchFieldException {
Project selectedProject = new Project();
setField(selectedProject, "id", 1L);
List<Project> projects = asList(selectedProject);
Filter filter = new Filter();
filter.setProjects(asList(selectedProject));
EasyMock.expect(filterBean.getCurrentFilter()).andReturn(filter).anyTimes();
EasyMock.expect(hoursService.getHours(filter)).andReturn(emptyList());
EasyMock.expect(projectService.getEffortsProjects(filter)).andReturn(projects);
EasyMock.replay(hoursService, projectService, filterBean);
Long[] actual = reportsBean.getSelectedProjectIds();
EasyMock.verify(hoursService, projectService, filterBean);
Assert.assertArrayEquals(new Long[] { 1L }, actual);
}
Aggregations