### Question:
SnapshotTask implements ForeignExceptionSnare, Callable<Void> { public void snapshotFailure(String message, Exception e) { ForeignException ee = new ForeignException(message, e); errorMonitor.receive(ee); } SnapshotTask(SnapshotDescription snapshot, ForeignExceptionDispatcher monitor); void snapshotFailure(String message, Exception e); @Override void rethrowException(); @Override boolean hasException(); @Override ForeignException getException();  }### Answer:
@Test public void testErrorPropagation() throws Exception { ForeignExceptionDispatcher error = mock(ForeignExceptionDispatcher.class); SnapshotDescription snapshot = SnapshotDescription.newBuilder().setName("snapshot") .setTable("table").build(); final Exception thrown = new Exception("Failed!"); SnapshotTask fail = new SnapshotTask(snapshot, error) { @Override public Void call() { snapshotFailure("Injected failure", thrown); return null; } }; fail.call(); verify(error, Mockito.times(1)).receive(any(ForeignException.class)); }