DefaultClockFactory implements ClockFactory, Serializable { @Override public Clock createClock(ProfilerConfig config) { Clock clock; boolean isEventTime = config.getTimestampField().isPresent(); if(isEventTime) { String timestampField = config.getTimestampField().get(); clock = new EventTimeClock(timestampField); } else { clock = new WallClock(); } return clock; }  @Override Clock createClock(ProfilerConfig config);  }
@Test public void testCreateEventTimeClock() { ProfilerConfig config = new ProfilerConfig(); config.setTimestampField(Optional.of("timestamp")); Clock clock = clockFactory.createClock(config); assertTrue(clock instanceof EventTimeClock); }
@Test public void testCreateProcessingTimeClock() { ProfilerConfig config = new ProfilerConfig(); Clock clock = clockFactory.createClock(config); assertTrue(clock instanceof WallClock); }