@Test public void testGoldenMaster() throws Exception { ObjectMapper mapper = new ObjectMapper(); final URL typfallJson = getClass().getResource("/TypfallStubResponse.json"); final Typfall typfall = mapper.readValue(typfallJson, Typfall.class); final URL fmdxInfoJson = getClass().getResource("/FmdxInfoStubResponse.json"); final FmdxInformation fmdxInformation = mapper.readValue(fmdxInfoJson, FmdxInformation.class); Mockito.when(fmbConsumer.getForsakringsmedicinskDiagnosinformation()).thenReturn(fmdxInformation); Mockito.when(fmbConsumer.getTypfall()).thenReturn(typfall); fmbServiceImpl.updateData(); Mockito.verify(diagnosInformationRepository, times(1)).saveAll(fmbCaptor.capture()); List<DiagnosInformation> fmbCaptorAllValues = fmbCaptor.getValue(); assertEquals(116, fmbCaptorAllValues.size()); }
@Override @Scheduled(cron = "${fmb.dataupdate.cron}") @SchedulerLock(name = JOB_NAME) public void updateData() { try { LOG.info("FMB data update started"); performUpdate(); LOG.info("FMB data update done"); } catch (Exception e) { LOG.error("Failed to update FMB", e); } }
FmbServiceImpl implements FmbService { @Override @Scheduled(cron = "${fmb.dataupdate.cron}") @SchedulerLock(name = JOB_NAME) public void updateData() { try { LOG.info("FMB data update started"); performUpdate(); LOG.info("FMB data update done"); } catch (Exception e) { LOG.error("Failed to update FMB", e); } } }
FmbServiceImpl implements FmbService { @Override @Scheduled(cron = "${fmb.dataupdate.cron}") @SchedulerLock(name = JOB_NAME) public void updateData() { try { LOG.info("FMB data update started"); performUpdate(); LOG.info("FMB data update done"); } catch (Exception e) { LOG.error("Failed to update FMB", e); } } FmbServiceImpl(final FmbConsumer fmbConsumer, final DiagnosInformationRepository repository); }
FmbServiceImpl implements FmbService { @Override @Scheduled(cron = "${fmb.dataupdate.cron}") @SchedulerLock(name = JOB_NAME) public void updateData() { try { LOG.info("FMB data update started"); performUpdate(); LOG.info("FMB data update done"); } catch (Exception e) { LOG.error("Failed to update FMB", e); } } FmbServiceImpl(final FmbConsumer fmbConsumer, final DiagnosInformationRepository repository); @Override @Scheduled(cron = "${fmb.dataupdate.cron}") @SchedulerLock(name = JOB_NAME) void updateData(); }
FmbServiceImpl implements FmbService { @Override @Scheduled(cron = "${fmb.dataupdate.cron}") @SchedulerLock(name = JOB_NAME) public void updateData() { try { LOG.info("FMB data update started"); performUpdate(); LOG.info("FMB data update done"); } catch (Exception e) { LOG.error("Failed to update FMB", e); } } FmbServiceImpl(final FmbConsumer fmbConsumer, final DiagnosInformationRepository repository); @Override @Scheduled(cron = "${fmb.dataupdate.cron}") @SchedulerLock(name = JOB_NAME) void updateData();  }