Search in sources :

Example 1 with DateUtil

use of org.activityinfo.legacy.shared.reports.util.DateUtil in project activityinfo by bedatadriven.

the class ReportGeneratorTest method testFileName.

@Test
public void testFileName() {
    // Input user
    User user = new User();
    user.setLocale("en");
    // Input test data: report model + parameter
    Report report = new Report();
    report.setFileName("Report ${DATE_RANGE} of Activities");
    // Input test data: parameter values
    DateUtil dateUtil = new DateUtilCalendarImpl();
    DateRange dateRange = dateUtil.monthRange(2009, 1);
    // class under test
    ReportGenerator generator = new ReportGenerator(null, null, null, null, null);
    generator.generate(user, report, null, dateRange);
    // VERIFY correct file name
    Assert.assertEquals("Report Jan 2009 of Activities", report.getContent().getFileName());
}
Also used : DateRange(org.activityinfo.legacy.shared.reports.model.DateRange) User(org.activityinfo.server.database.hibernate.entity.User) Report(org.activityinfo.legacy.shared.reports.model.Report) DateUtil(org.activityinfo.legacy.shared.reports.util.DateUtil) DateUtilCalendarImpl(org.activityinfo.server.report.util.DateUtilCalendarImpl) Test(org.junit.Test)

Aggregations

DateRange (org.activityinfo.legacy.shared.reports.model.DateRange)1 Report (org.activityinfo.legacy.shared.reports.model.Report)1 DateUtil (org.activityinfo.legacy.shared.reports.util.DateUtil)1 User (org.activityinfo.server.database.hibernate.entity.User)1 DateUtilCalendarImpl (org.activityinfo.server.report.util.DateUtilCalendarImpl)1 Test (org.junit.Test)1