public static TimelineEvent getApplicationEvent(TimelineEntity te,
      String eventId) {
    if (isApplicationEntity(te)) {
      for (TimelineEvent event : te.getEvents()) {
        if (event.getId().equals(eventId)) {
          return event;
        }
      }
    }
    return null;
  }
@Test
  void testGetApplicationEvent() {
    TimelineEntity te = null;
    TimelineEvent tEvent = ApplicationEntity.getApplicationEvent(te,
        "no event");
    assertEquals(null, tEvent);

    te = new TimelineEntity();
    te.setType(TimelineEntityType.YARN_APPLICATION.toString());
    TimelineEvent event = new TimelineEvent();
    event.setId("start_event");
    event.setTimestamp(System.currentTimeMillis());
    te.addEvent(event);
    tEvent = ApplicationEntity.getApplicationEvent(te, "start_event");
    assertEquals(event, tEvent);

    te = new TimelineEntity();
    te.setType(TimelineEntityType.YARN_CLUSTER.toString());
    event = new TimelineEvent();
    event.setId("start_event_cluster");
    event.setTimestamp(System.currentTimeMillis());
    te.addEvent(event);
    tEvent = ApplicationEntity.getApplicationEvent(te, "start_event_cluster");
    assertEquals(null, tEvent);

  }