ListDirectoryObserver extends DisposableObserver<File> { @Override public void onError(Throwable e) { Log.d("TAG", "onError : " + e.toString()); bus.post(new OperationFailedEvent()); } ListDirectoryObserver(DirectoryTree dataSet, EventBus bus); @Override void onComplete(); @Override void onError(Throwable e); @Override void onNext(File file);  }
@Test public void onErrorShouldNotifyOperationFailedEvent() throws Exception { sut.onError(new Exception()); verify(mockBus).post(any(OperationFailedEvent.class)); }