@Test void testReadRecentInstance() { JobDataMap legacyJobDataMap = mock(JobDataMap.class); when(legacyJobDataMap.get(EventMessage.class.getName())).thenReturn(new GenericEventMessage<>("new")); Object event = testSubject.fromJobData(legacyJobDataMap); verify(legacyJobDataMap, never()).get("org.axonframework.domain.EventMessage"); assertTrue(event instanceof EventMessage); EventMessage<?> eventMessage = (EventMessage<?>) event; assertEquals("new", eventMessage.getPayload()); assertEquals(0, eventMessage.getMetaData().size()); }
@Override public Object fromJobData(JobDataMap jobData) { Object message = delegate.fromJobData(jobData); if (message == null) { message = jobData.get(LEGACY_EVENT_KEY); } return message; }
LegacyAwareJobDataBinder implements EventJobDataBinder { @Override public Object fromJobData(JobDataMap jobData) { Object message = delegate.fromJobData(jobData); if (message == null) { message = jobData.get(LEGACY_EVENT_KEY); } return message; } }
LegacyAwareJobDataBinder implements EventJobDataBinder { @Override public Object fromJobData(JobDataMap jobData) { Object message = delegate.fromJobData(jobData); if (message == null) { message = jobData.get(LEGACY_EVENT_KEY); } return message; } LegacyAwareJobDataBinder();  LegacyAwareJobDataBinder(EventJobDataBinder delegate); }
LegacyAwareJobDataBinder implements EventJobDataBinder { @Override public Object fromJobData(JobDataMap jobData) { Object message = delegate.fromJobData(jobData); if (message == null) { message = jobData.get(LEGACY_EVENT_KEY); } return message; } LegacyAwareJobDataBinder();  LegacyAwareJobDataBinder(EventJobDataBinder delegate); @Override JobDataMap toJobData(Object eventMessage); @Override Object fromJobData(JobDataMap jobData); }
LegacyAwareJobDataBinder implements EventJobDataBinder { @Override public Object fromJobData(JobDataMap jobData) { Object message = delegate.fromJobData(jobData); if (message == null) { message = jobData.get(LEGACY_EVENT_KEY); } return message; } LegacyAwareJobDataBinder();  LegacyAwareJobDataBinder(EventJobDataBinder delegate); @Override JobDataMap toJobData(Object eventMessage); @Override Object fromJobData(JobDataMap jobData);  }