UseCase { @SuppressWarnings("unchecked") public void execute(Subscriber UseCaseSubscriber) { this.subscription = this.buildUseCaseObservable() .subscribeOn(Schedulers.from(threadExecutor)) .observeOn(postExecutionThread.getScheduler()) .subscribe(UseCaseSubscriber); }  void setThreadExecutor(ThreadExecutor threadExecutor); void setPostExecutionThread(PostExecutionThread postExecutionThread); @SuppressWarnings("unchecked") void execute(Subscriber UseCaseSubscriber); void unsubscribe();  }
@Test @SuppressWarnings("unchecked") public void testBuildUseCaseObservableReturnCorrectResult() { TestSubscriber<Integer> testSubscriber = new TestSubscriber<>(); TestScheduler testScheduler = new TestScheduler(); given(mockPostExecutionThread.getScheduler()).willReturn(testScheduler); useCase.execute(testSubscriber); assertThat(testSubscriber.getOnNextEvents().size(), is(0)); }