TimerInstanceSummaryMapper implements Function<TimerInstance, TimerInstanceSummary> { @Override public TimerInstanceSummary apply(TimerInstance timerInstance) { if (timerInstance == null) { return null; } TimerInstanceSummary summary = new TimerInstanceSummary(); summary.setId(timerInstance.getId()); summary.setTimerId(timerInstance.getTimerId()); summary.setName(timerInstance.getTimerName()); summary.setProcessInstanceId(timerInstance.getProcessInstanceId()); summary.setActivationTime(timerInstance.getActivationTime()); summary.setDelay(timerInstance.getDelay()); summary.setLastFireTime(timerInstance.getLastFireTime()); summary.setNextFireTime(timerInstance.getNextFireTime()); summary.setPeriod(timerInstance.getPeriod()); summary.setRepeatLimit(timerInstance.getRepeatLimit()); return summary; }  @Override TimerInstanceSummary apply(TimerInstance timerInstance);  }
@Test public void testTimerInstanceSummary() { TimerInstance ti = TimerInstance.builder() .id(1l) .timerId(0l) .timerName("timer") .activationTime(new Date()) .delay(2l) .nextFireTime(new Date()) .lastFireTime(new Date()) .repeatLimit(10) .period(3l) .processInstanceId(4l) .build(); assertTimerInstanceSummary(ti, new TimerInstanceSummaryMapper().apply(ti)); }
@Test public void testTimerInstanceSummaryNull() { assertNull(new TimerInstanceSummaryMapper().apply(null)); }