@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)); }
@SuppressWarnings("unchecked") public void execute(Subscriber useCaseSubscriber) { Subscription sub = this.buildUseCaseObservable() .subscribeOn(Schedulers.from(threadExecutor)) .observeOn(postExecutionThread.getScheduler()) .subscribe(useCaseSubscriber); this.subscription.add(sub); }
UseCase { @SuppressWarnings("unchecked") public void execute(Subscriber useCaseSubscriber) { Subscription sub = this.buildUseCaseObservable() .subscribeOn(Schedulers.from(threadExecutor)) .observeOn(postExecutionThread.getScheduler()) .subscribe(useCaseSubscriber); this.subscription.add(sub); } }
UseCase { @SuppressWarnings("unchecked") public void execute(Subscriber useCaseSubscriber) { Subscription sub = this.buildUseCaseObservable() .subscribeOn(Schedulers.from(threadExecutor)) .observeOn(postExecutionThread.getScheduler()) .subscribe(useCaseSubscriber); this.subscription.add(sub); } protected  UseCase(ThreadExecutor threadExecutor, PostExecutionThread postExecutionThread); }
UseCase { @SuppressWarnings("unchecked") public void execute(Subscriber useCaseSubscriber) { Subscription sub = this.buildUseCaseObservable() .subscribeOn(Schedulers.from(threadExecutor)) .observeOn(postExecutionThread.getScheduler()) .subscribe(useCaseSubscriber); this.subscription.add(sub); } protected  UseCase(ThreadExecutor threadExecutor, PostExecutionThread postExecutionThread); @SuppressWarnings("unchecked") void execute(Subscriber useCaseSubscriber); void unsubscribe(); }
UseCase { @SuppressWarnings("unchecked") public void execute(Subscriber useCaseSubscriber) { Subscription sub = this.buildUseCaseObservable() .subscribeOn(Schedulers.from(threadExecutor)) .observeOn(postExecutionThread.getScheduler()) .subscribe(useCaseSubscriber); this.subscription.add(sub); } protected  UseCase(ThreadExecutor threadExecutor, PostExecutionThread postExecutionThread); @SuppressWarnings("unchecked") void execute(Subscriber useCaseSubscriber); void unsubscribe();  }