ParseUserDataSource implements UserDataSource<ExampleUser> { @NonNull @Override public Observable<List<ExampleUser>> getAllUsers(UserQueries.GetAllUsersQuery query) { final ParseQuery<ParseUser> parseQuery = new ParseQuery<>("_User"); parseQuery.whereNotEqualTo("objectId", mParseHelper.getCurrentUser().getObjectId()); parseQuery.setCachePolicy(ParseQuery.CachePolicy.NETWORK_ONLY); return mParseHelper.find(parseQuery) .flatMap(Observable::from) .map(ParseUtils::fromParseUser) .toList() .subscribeOn(Schedulers.io()); } ParseUserDataSource(@NonNull ParseHelper parseHelper); @NonNull @Override Observable<List<ExampleUser>> getAllUsers(UserQueries.GetAllUsersQuery query); @NonNull @Override Observable<ExampleUser> getSingleUser(UserQueries.GetUserQuery query);  }
@Test public void getAllUsers() { List<ParseUser> users = ModelTestHelper.createParseUsers(10); when(mMockParseHelper.find(Mockito.<ParseQuery<ParseUser>>any())).thenReturn(Observable.just(users)); ParseUser currentUser = ModelTestHelper.createParseUser(CURRENT_USER); when(mMockParseHelper.getCurrentUser()).thenReturn(currentUser); TestSubscriber<List<ExampleUser>> testSubscriber = executeTarget(mTarget.getAllUsers(new UserQueries.GetAllUsersQuery())); assertThat(testSubscriber.getOnNextEvents().size(), is(1)); testSubscriber.assertCompleted(); }