### Question:
Predicate implements Serializable { public static Predicate getPredicate(Event event) throws FalconException { if (event.getType() == EventType.DATA_AVAILABLE) { DataEvent dataEvent = (DataEvent) event; if (dataEvent.getDataLocations() != null) { return createDataPredicate(dataEvent.getDataLocations()); } else { throw new FalconException("Event does not have enough data to create a predicate"); } } else if (event.getType() == EventType.TIME_ELAPSED) { TimeElapsedEvent timeEvent = (TimeElapsedEvent) event; if (timeEvent.getStartTime() != null && timeEvent.getEndTime() != null) { long instanceTime = (timeEvent.getInstanceTime() == null)? -1 : timeEvent.getInstanceTime().getMillis(); return Predicate.createTimePredicate(timeEvent.getStartTime().getMillis(), timeEvent.getEndTime().getMillis(), instanceTime); } else { throw new FalconException("Event does not have enough data to create a predicate"); } } else if (event.getType() == EventType.RE_RUN) { RerunEvent rerunEvent = (RerunEvent) event; if (rerunEvent.getInstanceTime() != null) { return Predicate.createRerunPredicate(rerunEvent.getInstanceTime().getMillis()); } else { throw new FalconException("Event does not have enough data to create a predicate"); } } else { throw new FalconException("Unhandled event type " + event.getType()); } } Predicate(TYPE type); TYPE getType(); String getId(); Comparable getClauseValue(String key); boolean evaluate(Predicate suppliedPredicate); Map<String, Comparable> getClauses(); static Predicate createTimePredicate(long start, long end, long instanceTime); static Predicate createDataPredicate(List<Path> paths); static Predicate createJobCompletionPredicate(NotificationHandler handler, ID id, int parallelInstances); static Predicate createRerunPredicate(long instanceTime); static Predicate getPredicate(Event event); static boolean isEqualAwaitingPredicates(List<Predicate> thisAwaitingPredicates,
                                              List<Predicate> otherAwaitingPredicates); static final Comparable<? extends Serializable> ANY; }### Answer:
@Test public void testPredicateFromEvent() throws FalconException { Process process = new Process(); process.setName("test"); DateTime now = DateTime.now(); TimeElapsedEvent te = new TimeElapsedEvent(new EntityID(process), now, now, now); Predicate.getPredicate(te); }