UserDataSource { public Observable<List<Event>> listNews(String user, int page) { return userApi.listNews(user, page, Constant.PER_PAGE_NEWS) .compose(RxJavaUtils.<List<Event>>applySchedulers()); } UserDataSource(GithubAuthRetrofit authRetrofit, UserService userApi, Context ctx); Observable<UserInfo> getUserInfo(String user); Observable<Boolean> login(final String userName, String password); Observable<List<UserEntity>> listFollowers(String userName, int page); Observable<List<UserEntity>> listFollowing(String user, int page); Observable<List<RepositoryInfo>> listStarredRepo(String user, int page); Observable<List<RepositoryInfo>> listStarredRepo(String user, SortType_Repo sort, int page); Observable<List<RepositoryInfo>> listWatchingRepo(String user, int page); Observable<List<RepositoryInfo>> listOwnRepo(String user, int page); Observable<List<Event>> listNews(String user, int page); Observable<SearchResult<UserEntity>> search(String keyWord, String language, SortType_User sort, int page); Observable<Boolean> signOut(); String getLoginUserName(); Observable<Boolean> toFollow(String user); Observable<Boolean> toUnFollow(String user); Observable<Boolean> checkIfFollowing(String user);  }
@Test public void listNews() throws Exception { TestSubscriber<List<Event>> subscriber = TestSubscriber.create(); userDataSource.listNews("TellH", 1).subscribe(subscriber); List<List<Event>> onNextEvents = subscriber.getOnNextEvents(); assertNotNull(onNextEvents); assertTrue(onNextEvents.size() == 1); System.out.println(onNextEvents.get(0).toString()); }