UserDataRepository implements UserRepository { @SuppressWarnings("Convert2MethodRef") @Override public Observable<List<User>> users() { final UserDataStore userDataStore = this.userDataStoreFactory.createCloudDataStore(); return userDataStore.userEntityList() .map(new Func1<List<UserEntity>, List<User>>() { @Override public List<User> call(List<UserEntity> userEntities) { return userEntityDataMapper.transform(userEntities); } }); } UserDataRepository(Context appContext);  UserDataRepository(UserDataStoreFactory dataStoreFactory,
	                          UserEntityDataMapper userEntityDataMapper); void setUserDataStoreFactory(UserDataStoreFactory userDataStoreFactory); void setUserEntityDataMapper(UserEntityDataMapper userEntityDataMapper); @SuppressWarnings("Convert2MethodRef") @Override Observable<List<User>> users(); @SuppressWarnings("Convert2MethodRef") @Override Observable<User> user(int userId);  }
@Test public void testGetUsersHappyCase() { List<UserEntity> usersList = new ArrayList<>(); usersList.add(new UserEntity()); given(mockUserDataStore.userEntityList()).willReturn(Observable.just(usersList)); userDataRepository.users(); verify(mockUserDataStoreFactory).createCloudDataStore(); verify(mockUserDataStore).userEntityList(); }