DiskUserDataStore implements UserDataStore { @Override public void getUserEntityDetails(int id, final UserDetailsCallback userDetailsCallback) { this.userCache.get(id, new UserCache.UserCacheCallback() { @Override public void onUserEntityLoaded(UserEntity userEntity) { userDetailsCallback.onUserEntityLoaded(userEntity); } @Override public void onError(Exception exception) { userDetailsCallback.onError(exception); } }); }  @Override void getUsersEntityList(UserListCallback userListCallback); @Override void getUserEntityDetails(int id,
                                     final UserDetailsCallback userDetailsCallback);  }
@Test public void testGetUserEntityByIdSuccessfully() { UserEntity mockUserEntity = mock(UserEntity.class); diskUserDataStore.getUserEntityDetails(FAKE_USER_ID, mockUserDetailsDataStoreCallback); verify(mockUserCache).get(anyInt(), userCacheCallbackArgumentCaptor.capture()); verifyZeroInteractions(mockUserDetailsDataStoreCallback); userCacheCallbackArgumentCaptor.getValue().onUserEntityLoaded(mockUserEntity); verify(mockUserDetailsDataStoreCallback).onUserEntityLoaded(mockUserEntity); }
@Test public void testGetUserEntityByIdError() { diskUserDataStore.getUserEntityDetails(FAKE_USER_ID, mockUserDetailsDataStoreCallback); verify(mockUserCache).get(anyInt(), userCacheCallbackArgumentCaptor.capture()); verifyZeroInteractions(mockUserDetailsDataStoreCallback); userCacheCallbackArgumentCaptor.getValue().onError(any(Exception.class)); verify(mockUserDetailsDataStoreCallback).onError(any(Exception.class)); }