UserDataRepository implements UserRepository { @SuppressWarnings("Convert2MethodRef") @Override public Observable<User> user(int userId) { final UserDataStore userDataStore = this.userDataStoreFactory.create(userId); return userDataStore.userEntityDetails(userId) .map(new Func1<UserEntity, User>() { @Override public User call(UserEntity userEntity) { return userEntityDataMapper.transform(userEntity); } }); } 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 testGetUserHappyCase() { UserEntity userEntity = new UserEntity(); given(mockUserDataStore.userEntityDetails(FAKE_USER_ID)).willReturn(Observable.just(userEntity)); userDataRepository.user(FAKE_USER_ID); verify(mockUserDataStoreFactory).create(FAKE_USER_ID); verify(mockUserDataStore).userEntityDetails(FAKE_USER_ID); }