@Test public void testFilter_ScrollResults() { TestObserver<Result> testObserver; NowPlayingInteractor nowPlayingInteractor = new NowPlayingInteractor(mockServiceController, filterTransformer); int pageNumber = 2; 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)); when(mockFilterManager.isFilterOn()).thenReturn(true); when(mockFilterManager.filterList(anyList())).thenReturn(new ArrayList<MovieInfo>()); testObserver = nowPlayingInteractor.processAction( Observable.just((Action) new ScrollAction(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(ScrollResult.class); ScrollResult scrollResult = (ScrollResult) result; assertThat(scrollResult.getPageNumber()).isEqualTo(pageNumber); assertThat(scrollResult.getError()).isNull(); assertThat(scrollResult.getResult()).isNull(); assertThat(scrollResult.getType()).isEqualTo(Result.ResultType.IN_FLIGHT); result = (Result) testObserver.getEvents().get(0).get(1); assertThat(result).isNotNull(); assertThat(result).isInstanceOf(ScrollResult.class); scrollResult = (ScrollResult) result; assertThat(scrollResult.getPageNumber()).isEqualTo(pageNumber); assertThat(scrollResult.getError()).isNull(); assertThat(scrollResult.getResult()).isEmpty(); assertThat(scrollResult.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);  }