@Test public void testResultAction_pass() { TestObserver<Result> testObserver; NowPlayingInteractor nowPlayingInteractor = new NowPlayingInteractor(mockServiceController, filterTransformer); List<MovieInfo> movieInfoList = new ArrayList<MovieInfo>(); for (int i = 0; i < 5; i++) { movieInfoList.add(movieInfo); } NowPlayingInfo nowPlayingInfo = new NowPlayingInfoImpl(movieInfoList, pageNumber, totalPageNumber); when(mockServiceController.getNowPlaying(anyInt())).thenReturn( Observable.just(nowPlayingInfo)); testObserver = nowPlayingInteractor.processAction( Observable.just((Action) new RestoreAction(pageNumber))).test(); testScheduler.advanceTimeBy(4, TimeUnit.SECONDS); testScheduler.triggerActions(); testObserver.assertNoErrors(); testObserver.assertValueCount(2); Result result = (Result) testObserver.getEvents().get(0).get(0); assertThat(result).isNotNull(); assertThat(result).isInstanceOf(RestoreResult.class); RestoreResult restoreResult = (RestoreResult) result; assertThat(restoreResult.getPageNumber()).isEqualTo(pageNumber); assertThat(restoreResult.getError()).isNull(); assertThat(restoreResult.getResult()).isNull(); assertThat(restoreResult.getType()).isEqualTo(Result.ResultType.IN_FLIGHT); result = (Result) testObserver.getEvents().get(0).get(1); assertThat(result).isNotNull(); assertThat(result).isInstanceOf(RestoreResult.class); restoreResult = (RestoreResult) result; assertThat(restoreResult.getPageNumber()).isEqualTo(pageNumber); assertThat(restoreResult.getError()).isNull(); assertThat(restoreResult.getResult()).isNotEmpty(); assertThat(restoreResult.getResult()).hasSize(5); assertThat(restoreResult.getType()).isEqualTo(Result.ResultType.SUCCESS); }
public Observable<Result> processAction(Observable<Action> actions) { return actions.compose(transformActionIntoResults); }
NowPlayingInteractor { public Observable<Result> processAction(Observable<Action> actions) { return actions.compose(transformActionIntoResults); } }
NowPlayingInteractor { public Observable<Result> processAction(Observable<Action> actions) { return actions.compose(transformActionIntoResults); } @SuppressWarnings("checkstyle:magicnumber")  NowPlayingInteractor(@NonNull ServiceController serviceControllerIn, @NonNull FilterTransformer filterTransformerIn); }
NowPlayingInteractor { public Observable<Result> processAction(Observable<Action> actions) { return actions.compose(transformActionIntoResults); } @SuppressWarnings("checkstyle:magicnumber")  NowPlayingInteractor(@NonNull ServiceController serviceControllerIn, @NonNull FilterTransformer filterTransformerIn); Observable<Result> processAction(Observable<Action> actions); }
NowPlayingInteractor { public Observable<Result> processAction(Observable<Action> actions) { return actions.compose(transformActionIntoResults); } @SuppressWarnings("checkstyle:magicnumber")  NowPlayingInteractor(@NonNull ServiceController serviceControllerIn, @NonNull FilterTransformer filterTransformerIn); Observable<Result> processAction(Observable<Action> actions);  }