CheckedDatastoreReaderWriter { Entity add(FullEntity<?> entity) throws IOException { return call(() -> rw.add(entity)); } CheckedDatastoreReaderWriter(DatastoreReaderWriter rw);   }
@Test public void addShouldThrowCheckedException() throws IOException { when(rw.add(entity1)).thenThrow(CAUSE); exception.expect(IOException.class); exception.expectCause(is((Throwable) CAUSE)); sut.add(entity1); }
@Test public void add() throws IOException { when(rw.add(entity1)).thenReturn(entity1); assertThat(sut.add(entity1), is(entity1)); verify(rw).add(entity1); }