@Test
public void testScheduleEvent() {

  final User user = new User("testUser2");
  // Add a customized event listener
  project.addListener((event) -> {
    ProjectEvent projectEvent = (ProjectEvent) event;
    // Check schedule event metadata
    Assert.assertEquals("Event metadata not created as expected.", "testUser2", projectEvent.getEventData().get("modifiedBy"));
    Assert.assertEquals("Event metadata not created as expected.", flowName, projectEvent.getEventData().get("flowName"));
    Assert.assertEquals("Event metadata not created as expected.", firstSchedTime.getMillis(), projectEvent.getEventData().get("firstScheduledExecutionTime"));
    Assert.assertEquals("Event metadata not created as expected.", endSchedTime, projectEvent.getEventData().get("lastScheduledExecutionTime"));
    Assert.assertEquals("Event metadata not created as expected.", timezone.toString(), projectEvent.getEventData().get("timezone"));
    Assert.assertEquals("Event metadata not created as expected.", cronExpression, projectEvent.getEventData().get("cronExpression"));
    Assert.assertEquals("Event metadata not created as expected.", "SUCCESS", projectEvent.getEventData().get("projectEventStatus"));
    Assert.assertEquals("Event metadata not created as expected.", "null", projectEvent.getEventData().get("errorMessage"));
  });
  // Create a new schedule
  final Schedule schedule =
          new Schedule(0, project.getId(), project.getName(), flowName, "schedule",
                  firstSchedTime.getMillis(), endSchedTime, timezone, null, DateTime.now().getMillis(),
                  firstSchedTime.getMillis(), firstSchedTime.getMillis(), user.getUserId(), null, cronExpression);
  manager.postScheduleEvent(project, azkaban.spi.EventType.SCHEDULE_CREATED, user,
          schedule, null);
}