ZMSNotificationTaskFactory implements NotificationTaskFactory { @Override public List<NotificationTask> getNotificationTasks() { List<NotificationTask> notificationTasks = new ArrayList<>(); int pendingRoleMemberLifespan = Integer.parseInt(System.getProperty(ZMSConsts.ZMS_PROP_PENDING_ROLE_MEMBER_LIFESPAN, ZMSConsts.ZMS_PENDING_ROLE_MEMBER_LIFESPAN_DEFAULT)); String monitorIdentity = System.getProperty(ZMSConsts.ZMS_PROP_MONITOR_IDENTITY, ZMSConsts.SYS_AUTH_MONITOR); notificationTasks.add(new PendingRoleMembershipApprovalNotificationTask(dbService, pendingRoleMemberLifespan, monitorIdentity, userDomainPrefix)); notificationTasks.add(new PendingGroupMembershipApprovalNotificationTask(dbService, pendingRoleMemberLifespan, monitorIdentity, userDomainPrefix)); notificationTasks.add(new RoleMemberExpiryNotificationTask(dbService, userDomainPrefix)); notificationTasks.add(new RoleMemberReviewNotificationTask(dbService, userDomainPrefix)); notificationTasks.add(new GroupMemberExpiryNotificationTask(dbService, userDomainPrefix)); return notificationTasks; } ZMSNotificationTaskFactory(DBService dbService, String userDomainPrefix); @Override List<NotificationTask> getNotificationTasks();  }
@Test public void testNotificationTasksOrdering() { DBService dbsvc = Mockito.mock(DBService.class); ZMSNotificationTaskFactory zmsNotificationTaskFactory = new ZMSNotificationTaskFactory(dbsvc, USER_DOMAIN_PREFIX); List<NotificationTask> notificationTasks = zmsNotificationTaskFactory.getNotificationTasks(); assertEquals(5, notificationTasks.size()); assertEquals(notificationTasks.get(0).getDescription(), "pending role membership approvals reminders"); assertEquals(notificationTasks.get(1).getDescription(), "pending group membership approvals reminders"); assertEquals(notificationTasks.get(2).getDescription(), "membership expiration reminders"); assertEquals(notificationTasks.get(3).getDescription(), "Periodic Review Reminder"); assertEquals(notificationTasks.get(4).getDescription(), "group membership expiration reminders"); }