@SuppressWarnings("unchecked")
@Test
public void testHandleReportRequest() throws Exception {

	final ReportFormat format = ReportFormat.HTML;
	DateTimeFormatter df = DateTimeFormatter.ofPattern("MM/dd/yyyy");
	final LocalDate startDate = LocalDate.parse("03/01/2015",df);
	final LocalDate endDate = LocalDate.parse("06/01/2015",df);
	
	DateTimeFormatter dtf = DateTimeFormatter.ofPattern("MM/dd/yyyy HH:mm:ss");
	final LocalDateTime startDateTime = LocalDateTime.parse("03/01/2015 00:00:00", dtf);
	final LocalDateTime endDateTime = LocalDateTime.parse("06/01/2015 23:59:59", dtf);
	when(reportUtils.getStartDateTime(startDate)).thenReturn(startDateTime);
	when(reportUtils.getEndDateTime(endDate)).thenReturn(endDateTime);
	
	final Boolean noInformation = false;
	final Boolean noDescription = false;
	
	final ManagerReportEntryDto entry = new ManagerReportEntryDto();
	final long startSqlTimeStamp = 1425186000000l;
	when(reportUtils.convertLocalDateTimeToEpoch(startDateTime)).thenReturn(startSqlTimeStamp);
	final long endSqlTimeStamp = 1433217599000l;
	when(reportUtils.convertLocalDateTimeToEpoch(endDateTime)).thenReturn(endSqlTimeStamp);
	Object[] args = new Object[] { startSqlTimeStamp, endSqlTimeStamp };
	@SuppressWarnings("rawtypes")
	final Collection managerReport = Arrays.asList(entry);
	when(reportDataProvider.getReportData(args)).thenReturn(managerReport);
	
	final RequestScopedParameters requestScopedParameters = new RequestScopedParameters();
	requestScopedParameters.add("startDateTime", startDateTime);
	requestScopedParameters.add("endDateTime", endDateTime);
	requestScopedParameters.add("noInformation", noInformation);
	requestScopedParameters.add("noDescription", noDescription);
	when(requestScopedParametersProvider.getRequestScopedParameters()).thenReturn(requestScopedParameters);
	
	final Map<String, Object> parameters = new HashMap<>();
	final String key = "key";
	final Object value = "value";
	parameters.put(key, value);
	when(
			abstractReportConfig.configure(eq(format),
					any(JRDataSource.class))).thenReturn(parameters);
	when(abstractReportConfig.getReportName()).thenReturn(
			ManagerReportConfig.REPORT_NAME);
	// Act
	mockMvc.perform(get("/Administrator/reports/managerReport?startDate="+startDate.format(df)+"&endDate="+endDate.format(df)))
	.andExpect(status().isOk())
	.andExpect(model().attribute("key", "value"))
	.andExpect(model().size(parameters.size()))
	.andExpect(view().name(ManagerReportConfig.REPORT_NAME));
	// Assert
	verify(reportDataProvider, times(1)).getReportData(args);
	verify(abstractReportConfig, times(1)).configure(eq(format),
			any(JRDataSource.class));
}