@Test public void test_data_class_type_equals() { Instant now = Instant.now(); OneTimeTask<Integer> task = TestTasks.oneTime("OneTime", Integer.class, (instance, executionContext) -> {}); Execution execution = new Execution(now, task.instance("id1", new Integer(1))); ScheduledExecution<Integer> scheduledExecution = new ScheduledExecution<>(Integer.class, execution); assertEquals(new Integer(1), scheduledExecution.getData()); }
@SuppressWarnings("unchecked") public DATA_TYPE getData() { if (dataClass.isInstance(this.execution.taskInstance.getData())) { return (DATA_TYPE) this.execution.taskInstance.getData(); } throw new DataClassMismatchException(); }
ScheduledExecution { @SuppressWarnings("unchecked") public DATA_TYPE getData() { if (dataClass.isInstance(this.execution.taskInstance.getData())) { return (DATA_TYPE) this.execution.taskInstance.getData(); } throw new DataClassMismatchException(); } }
ScheduledExecution { @SuppressWarnings("unchecked") public DATA_TYPE getData() { if (dataClass.isInstance(this.execution.taskInstance.getData())) { return (DATA_TYPE) this.execution.taskInstance.getData(); } throw new DataClassMismatchException(); } ScheduledExecution(Class<DATA_TYPE> dataClass, Execution execution); }
ScheduledExecution { @SuppressWarnings("unchecked") public DATA_TYPE getData() { if (dataClass.isInstance(this.execution.taskInstance.getData())) { return (DATA_TYPE) this.execution.taskInstance.getData(); } throw new DataClassMismatchException(); } ScheduledExecution(Class<DATA_TYPE> dataClass, Execution execution); TaskInstanceId getTaskInstance(); Instant getExecutionTime(); @SuppressWarnings("unchecked") DATA_TYPE getData(); @Override boolean equals(Object o); @Override int hashCode(); }
ScheduledExecution { @SuppressWarnings("unchecked") public DATA_TYPE getData() { if (dataClass.isInstance(this.execution.taskInstance.getData())) { return (DATA_TYPE) this.execution.taskInstance.getData(); } throw new DataClassMismatchException(); } ScheduledExecution(Class<DATA_TYPE> dataClass, Execution execution); TaskInstanceId getTaskInstance(); Instant getExecutionTime(); @SuppressWarnings("unchecked") DATA_TYPE getData(); @Override boolean equals(Object o); @Override int hashCode();  }