Search in sources :

Example 6 with ReportSubscription

use of org.activityinfo.server.database.hibernate.entity.ReportSubscription in project activityinfo by bedatadriven.

the class ReportMailerTest method testLastDayOfMonth.

@Test
public void testLastDayOfMonth() {
    ReportSubscription report = new ReportSubscription();
    report.setEmailDelivery(EmailDelivery.MONTHLY);
    report.setEmailDay(Report.LAST_DAY_OF_MONTH);
    Calendar cal = Calendar.getInstance();
    cal.set(Calendar.YEAR, 2009);
    cal.set(Calendar.MONTH, Calendar.APRIL);
    cal.set(Calendar.DATE, 30);
    Assert.assertTrue("Report goes out on 4-April", ReportMailerHelper.mailToday(cal.getTime(), report));
    cal.set(Calendar.MONTH, Calendar.JANUARY);
    cal.set(Calendar.DATE, 31);
    Assert.assertTrue("Report goes out on 31-Jan", ReportMailerHelper.mailToday(cal.getTime(), report));
}
Also used : ReportSubscription(org.activityinfo.server.database.hibernate.entity.ReportSubscription) Calendar(java.util.Calendar) Test(org.junit.Test)

Aggregations

ReportSubscription (org.activityinfo.server.database.hibernate.entity.ReportSubscription)6 Calendar (java.util.Calendar)3 Test (org.junit.Test)3 Report (org.activityinfo.legacy.shared.reports.model.Report)2 IOException (java.io.IOException)1 Date (java.util.Date)1 MessagingException (javax.mail.MessagingException)1 ReportDefinition (org.activityinfo.server.database.hibernate.entity.ReportDefinition)1 User (org.activityinfo.server.database.hibernate.entity.User)1 SAXException (org.xml.sax.SAXException)1