AccountingDataController { @RequestMapping("renderAccountingData.ftl") public final ModelAndView showAccountingDataFor(@RequestParam(value = FROM_DATE) String paramFromDate, @RequestParam(value = TO_DATE) String paramToDate) { DateTimeFormatter fmt = DateTimeFormat.forPattern("yyyy-MM-dd"); LocalDate fromDate = fmt.parseDateTime(paramFromDate).toLocalDate(); LocalDate toDate = fmt.parseDateTime(paramToDate).toLocalDate(); Boolean hasAlreadyRanQuery = Boolean.FALSE; String fileName = null; List<AccountingDto> accountingData = new ArrayList<AccountingDto>(); try { fileName = accountingService.getExportOutputFileName(fromDate, toDate).replace(".xml", ""); hasAlreadyRanQuery = accountingService.hasAlreadyRanQuery(fromDate, toDate); accountingData = accountingService.getExportDetails(fromDate, toDate); } catch (Exception e) { LOGGER.error(e.getMessage(), e); } ModelAndView mav = new ModelAndView("renderAccountingData"); List<BreadCrumbsLinks> breadcrumbs = new AdminBreadcrumbBuilder() .withLink("accounting.viewaccountingexports", "renderAccountingDataCacheInfo.ftl") .withLink(fileName, "").build(); mav.addObject("breadcrumbs", breadcrumbs); mav.addObject("accountingData", accountingData); mav.addObject("hasAlreadyRanQuery", hasAlreadyRanQuery); mav.addObject("fileName", fileName); mav.addObject("fromDate", fromDate); mav.addObject("toDate", toDate); return mav; } @Autowired  AccountingDataController(AccountingService accountingService); @RequestMapping("renderAccountingData.ftl") final ModelAndView showAccountingDataFor(@RequestParam(value = FROM_DATE) String paramFromDate,
            @RequestParam(value = TO_DATE) String paramToDate); @RequestMapping("confirmExportsDelete.ftl") final ModelAndView confirmExportsDelete(); @RequestMapping("deleteCacheDir.ftl") final ModelAndView deleteCacheDir(); @RequestMapping("generateExportsList.ftl") final ModelAndView generateList(@RequestParam(value = LIST_START_DAY) Integer listStartDay, @RequestParam(value = "type") String type); @RequestMapping("renderAccountingDataCacheInfo.ftl") final ModelAndView listAllExports();  }
@Test public void testShowAccountingDataForWithNull() { accountingDataController.showAccountingDataFor("2010-05-10", "2010-05-10"); }
@Test public void testShowAccountingDataFor() { when(accountingService.hasAlreadyRanQuery(any(LocalDate.class), any(LocalDate.class))).thenReturn(true); when(accountingService.getExportOutputFileName(any(LocalDate.class), any(LocalDate.class))).thenReturn( "dummyfile"); when(accountingService.getExportDetails(any(LocalDate.class), any(LocalDate.class))).thenReturn(null); accountingDataController.showAccountingDataFor("2010-05-10", "2010-05-10"); }