@Test public void testDoFormatNewAction() { Schedule firstCompleted = updateStatus(REFERENCE_SCHEDULE, newSchedulingStatus(SchedulingState.Succeeded)); Schedule nextAction = firstCompleted.toBuilder() .withCurrentAction(ScheduledAction.newBuilder() .withId("reference") .withStatus(newSchedulingStatus(SchedulingState.Waiting)) .withIteration(ExecutionId.initial()) .build() ) .withCompletedActions(Collections.singletonList(firstCompleted.getCurrentAction())) .build(); verify(LocalSchedulerTransactionLogger.doFormat(new ScheduleUpdateEvent(nextAction))); }
@VisibleForTesting static String doFormat(LocalSchedulerEvent event) { if (event instanceof ScheduleAddedEvent) { return logScheduleAddedEvent((ScheduleAddedEvent) event); } else if (event instanceof ScheduleRemovedEvent) { return logScheduleRemovedEvent((ScheduleRemovedEvent) event); } if (event instanceof ScheduleUpdateEvent) { return logScheduleUpdateEvent((ScheduleUpdateEvent) event); } return "Unknown event type: " + event.getClass(); }
LocalSchedulerTransactionLogger { @VisibleForTesting static String doFormat(LocalSchedulerEvent event) { if (event instanceof ScheduleAddedEvent) { return logScheduleAddedEvent((ScheduleAddedEvent) event); } else if (event instanceof ScheduleRemovedEvent) { return logScheduleRemovedEvent((ScheduleRemovedEvent) event); } if (event instanceof ScheduleUpdateEvent) { return logScheduleUpdateEvent((ScheduleUpdateEvent) event); } return "Unknown event type: " + event.getClass(); } }
LocalSchedulerTransactionLogger { @VisibleForTesting static String doFormat(LocalSchedulerEvent event) { if (event instanceof ScheduleAddedEvent) { return logScheduleAddedEvent((ScheduleAddedEvent) event); } else if (event instanceof ScheduleRemovedEvent) { return logScheduleRemovedEvent((ScheduleRemovedEvent) event); } if (event instanceof ScheduleUpdateEvent) { return logScheduleUpdateEvent((ScheduleUpdateEvent) event); } return "Unknown event type: " + event.getClass(); }  }
LocalSchedulerTransactionLogger { @VisibleForTesting static String doFormat(LocalSchedulerEvent event) { if (event instanceof ScheduleAddedEvent) { return logScheduleAddedEvent((ScheduleAddedEvent) event); } else if (event instanceof ScheduleRemovedEvent) { return logScheduleRemovedEvent((ScheduleRemovedEvent) event); } if (event instanceof ScheduleUpdateEvent) { return logScheduleUpdateEvent((ScheduleUpdateEvent) event); } return "Unknown event type: " + event.getClass(); }   }
LocalSchedulerTransactionLogger { @VisibleForTesting static String doFormat(LocalSchedulerEvent event) { if (event instanceof ScheduleAddedEvent) { return logScheduleAddedEvent((ScheduleAddedEvent) event); } else if (event instanceof ScheduleRemovedEvent) { return logScheduleRemovedEvent((ScheduleRemovedEvent) event); } if (event instanceof ScheduleUpdateEvent) { return logScheduleUpdateEvent((ScheduleUpdateEvent) event); } return "Unknown event type: " + event.getClass(); }    }