CheckedDatastoreReaderWriter { static void run(Runnable f) throws IOException { call(() -> { f.run(); return null; }); } CheckedDatastoreReaderWriter(DatastoreReaderWriter rw);   }
@Test public void runShouldThrowCheckedException() throws IOException { exception.expect(IOException.class); exception.expectCause(is((Throwable) CAUSE)); CheckedDatastoreReaderWriter.run(() -> { throw CAUSE; }); }
@Test public void run() throws IOException { CheckedDatastoreReaderWriter.run(runnable); verify(runnable).run(); }
@Test public void runShouldPropagateIOException() throws IOException { final IOException cause = new IOException("foobar"); exception.expect(is(cause)); CheckedDatastoreReaderWriter.run(() -> { throw new RuntimeIOException(cause); }); }