@Test @DataSet public void testGetListCount() { StandupReportSearchCriteria criteria = new StandupReportSearchCriteria(); criteria.setProjectId(new NumberSearchField(1)); criteria.setSaccountid(new NumberSearchField(1)); Date from = new GregorianCalendar(2013, 2, 1).getTime(); Date to = new GregorianCalendar(2013, 2, 31).getTime(); criteria.setReportDateRange(new RangeDateSearchField(from, to)); List<GroupItem> reportsCount = reportService.getReportsCount(criteria); assertThat(reportsCount.size()).isEqualTo(2); }
@SuppressWarnings("unchecked") @Test @DataSet public void gatherStandupList() { StandupReportSearchCriteria criteria = new StandupReportSearchCriteria(); criteria.setProjectId(new NumberSearchField(1)); criteria.setLogBy(new StringSearchField("hainguyen")); Date d = new GregorianCalendar(2013, 2, 13).getTime(); criteria.setOnDate(new DateSearchField(d)); criteria.setSaccountid(new NumberSearchField(1)); List<SimpleStandupReport> reports = reportService.findPagableListByCriteria( new SearchRequest<>(criteria, 0, Integer.MAX_VALUE)); assertThat(reports.size()).isEqualTo(1); assertThat(reports).extracting("id", "logby", "whattoday").contains(tuple(1, "hainguyen", "a")); }
@Override public SimpleStandupReport findStandupReportByDateUser( Integer projectId, String username, Date onDate, Integer sAccountId) { StandupReportSearchCriteria criteria = new StandupReportSearchCriteria(); criteria.setProjectId(new NumberSearchField(projectId)); criteria.setLogBy(StringSearchField.and(username)); criteria.setOnDate(new DateSearchField(onDate)); List reports = standupReportMapperExt.findPagableListByCriteria( criteria, new RowBounds(0, Integer.MAX_VALUE)); if (CollectionUtils.isNotEmpty(reports)) { return (SimpleStandupReport) reports.get(0); } return null; }