CloudUserDataStore implements UserDataStore { @Override public void getUserEntityDetails(int id, final UserDetailsCallback userDetailsCallback) { this.restApi.getUserById(id, new RestApi.UserDetailsCallback() { @Override public void onUserEntityLoaded(UserEntity userEntity) { userDetailsCallback.onUserEntityLoaded(userEntity); } @Override public void onError(Exception exception) { userDetailsCallback.onError(exception); } }); }  @Override void getUsersEntityList(final UserListCallback userListCallback); @Override void getUserEntityDetails(int id,
                                     final UserDetailsCallback userDetailsCallback);  }
@Test public void testGetUserEntityDetailsSuccessfully() { UserEntity mockUserEntity = mock(UserEntity.class); cloudUserDataStore.getUserEntityDetails(FAKE_USER_ID, mockUserDetailsDataStoreCallback); verify(mockRestApi).getUserById(anyInt(), restApiUserDetailsCallbackArgumentCaptor.capture()); verifyZeroInteractions(mockUserDetailsDataStoreCallback); verifyZeroInteractions(mockUserCache); restApiUserDetailsCallbackArgumentCaptor.getValue().onUserEntityLoaded(mockUserEntity); verify(mockUserDetailsDataStoreCallback).onUserEntityLoaded(mockUserEntity); }
@Test public void testGetUserEntityDetailsError() { cloudUserDataStore.getUserEntityDetails(FAKE_USER_ID, mockUserDetailsDataStoreCallback); verify(mockRestApi).getUserById(anyInt(), restApiUserDetailsCallbackArgumentCaptor.capture()); verifyZeroInteractions(mockUserDetailsDataStoreCallback); restApiUserDetailsCallbackArgumentCaptor.getValue().onError(any(Exception.class)); verify(mockUserDetailsDataStoreCallback).onError(any(Exception.class)); verifyZeroInteractions(mockUserCache); }