@Test public void happyPath() throws IOException { when(keySupplier.get()).thenReturn(KEY); when(outputStreamFactory.apply(KEY)).thenReturn(outputStream); underTest.performBackup(); InOrder inOrder = inOrder(mapper, keySupplier, outputStreamFactory, outputStream); inOrder.verify(keySupplier).get(); inOrder.verify(outputStreamFactory).apply(KEY); inOrder.verify(mapper).writeValue(outputStream, store); inOrder.verify(outputStream).close(); }
@Scheduled(cron = "0 0 * * * *") void performBackup() throws IOException { log.info("Starting backup."); try (OutputStream output = outputStreamFactory.apply(keySupplier.get())) { mapper.writeValue(output, store); } log.info("Backup completed."); }
Towtruck { @Scheduled(cron = "0 0 * * * *") void performBackup() throws IOException { log.info("Starting backup."); try (OutputStream output = outputStreamFactory.apply(keySupplier.get())) { mapper.writeValue(output, store); } log.info("Backup completed."); } }
Towtruck { @Scheduled(cron = "0 0 * * * *") void performBackup() throws IOException { log.info("Starting backup."); try (OutputStream output = outputStreamFactory.apply(keySupplier.get())) { mapper.writeValue(output, store); } log.info("Backup completed."); }  }
Towtruck { @Scheduled(cron = "0 0 * * * *") void performBackup() throws IOException { log.info("Starting backup."); try (OutputStream output = outputStreamFactory.apply(keySupplier.get())) { mapper.writeValue(output, store); } log.info("Backup completed."); }   }
Towtruck { @Scheduled(cron = "0 0 * * * *") void performBackup() throws IOException { log.info("Starting backup."); try (OutputStream output = outputStreamFactory.apply(keySupplier.get())) { mapper.writeValue(output, store); } log.info("Backup completed."); }    }