CloudUserDataStore implements UserDataStore { @Override public void getUsersEntityList(final UserListCallback userListCallback) { this.restApi.getUserList(new RestApi.UserListCallback() { @Override public void onUserListLoaded(Collection<UserEntity> usersCollection) { userListCallback.onUserListLoaded(usersCollection); } @Override public void onError(Exception exception) { userListCallback.onError(exception); } }); }  @Override void getUsersEntityList(final UserListCallback userListCallback); @Override void getUserEntityDetails(int id,
                                     final UserDetailsCallback userDetailsCallback);  }
@Test @SuppressWarnings("unchecked") public void testGetUserEntityListSuccessfully() { Collection<UserEntity> mockUserEntityCollection = (Collection<UserEntity>) mock(Collection.class); cloudUserDataStore.getUsersEntityList(mockUserListDataStoreCallback); verify(mockRestApi).getUserList(restApiUserListCallbackArgumentCaptor.capture()); verifyZeroInteractions(mockUserListDataStoreCallback); verifyZeroInteractions(mockUserCache); restApiUserListCallbackArgumentCaptor.getValue().onUserListLoaded(mockUserEntityCollection); verify(mockUserListDataStoreCallback).onUserListLoaded(mockUserEntityCollection); }
@Test public void testGetUserEntityListError() { cloudUserDataStore.getUsersEntityList(mockUserListDataStoreCallback); verify(mockRestApi).getUserList(restApiUserListCallbackArgumentCaptor.capture()); verifyZeroInteractions(mockUserListDataStoreCallback); restApiUserListCallbackArgumentCaptor.getValue().onError(any(Exception.class)); verify(mockUserListDataStoreCallback).onError(any(Exception.class)); verifyZeroInteractions(mockUserCache); }