@Test public void testGetAllUserFeedbackSuccess() { com.intuit.wasabi.repository.cassandra.pojo.UserFeedback userFeedback = new com.intuit.wasabi.repository.cassandra.pojo.UserFeedback(); userFeedback.setUserId("userid1"); userFeedback.setSubmitted(new Date()); userFeedback.setScore(2); userFeedback.setComment("comments1"); userFeedback.setContactOkay(true); userFeedback.setUserEmail("userId1@example.com"); when(userFeedbackAccessor.getAllUserFeedback()).thenReturn(result); List<com.intuit.wasabi.repository.cassandra.pojo.UserFeedback> userFeedbacks = new ArrayList<>(); userFeedbacks.add(userFeedback); when(result.all()).thenReturn(userFeedbacks); List<UserFeedback> response = repository.getAllUserFeedback(); assertEquals("Size should be eq", 1, response.size()); UserFeedback feedback = response.get(0); assertEquals("user should be same", userFeedback.getUserId(), feedback.getUsername().getUsername()); assertEquals("submitted should be same", userFeedback.getSubmitted(), feedback.getSubmitted()); assertEquals("score should be same", userFeedback.getScore(), feedback.getScore()); assertEquals("contactOk should be same", userFeedback.isContactOkay(), feedback.isContactOkay()); assertEquals("email should be same", userFeedback.getUserEmail(), feedback.getEmail()); }
@Override public List<UserFeedback> getAllUserFeedback() { LOGGER.debug("Getting all user feedbacks "); List<UserFeedback> feedbacks = new ArrayList<>(); try { Result<com.intuit.wasabi.repository.cassandra.pojo.UserFeedback> result = userFeedbackAccessor.getAllUserFeedback(); feedbacks = makeFeedbacksFromResult(result); } catch (Exception e) { LOGGER.error("Error while getting all user feedback", e); throw new RepositoryException("Could not retrieve feedback from all users", e); } return feedbacks; }
CassandraFeedbackRepository implements FeedbackRepository { @Override public List<UserFeedback> getAllUserFeedback() { LOGGER.debug("Getting all user feedbacks "); List<UserFeedback> feedbacks = new ArrayList<>(); try { Result<com.intuit.wasabi.repository.cassandra.pojo.UserFeedback> result = userFeedbackAccessor.getAllUserFeedback(); feedbacks = makeFeedbacksFromResult(result); } catch (Exception e) { LOGGER.error("Error while getting all user feedback", e); throw new RepositoryException("Could not retrieve feedback from all users", e); } return feedbacks; } }
CassandraFeedbackRepository implements FeedbackRepository { @Override public List<UserFeedback> getAllUserFeedback() { LOGGER.debug("Getting all user feedbacks "); List<UserFeedback> feedbacks = new ArrayList<>(); try { Result<com.intuit.wasabi.repository.cassandra.pojo.UserFeedback> result = userFeedbackAccessor.getAllUserFeedback(); feedbacks = makeFeedbacksFromResult(result); } catch (Exception e) { LOGGER.error("Error while getting all user feedback", e); throw new RepositoryException("Could not retrieve feedback from all users", e); } return feedbacks; } @Inject  CassandraFeedbackRepository(UserFeedbackAccessor userFeedbackAccessor); }
CassandraFeedbackRepository implements FeedbackRepository { @Override public List<UserFeedback> getAllUserFeedback() { LOGGER.debug("Getting all user feedbacks "); List<UserFeedback> feedbacks = new ArrayList<>(); try { Result<com.intuit.wasabi.repository.cassandra.pojo.UserFeedback> result = userFeedbackAccessor.getAllUserFeedback(); feedbacks = makeFeedbacksFromResult(result); } catch (Exception e) { LOGGER.error("Error while getting all user feedback", e); throw new RepositoryException("Could not retrieve feedback from all users", e); } return feedbacks; } @Inject  CassandraFeedbackRepository(UserFeedbackAccessor userFeedbackAccessor); @Override void createUserFeedback(UserFeedback userFeedback); @Override List<UserFeedback> getUserFeedback(UserInfo.Username username); @Override List<UserFeedback> getAllUserFeedback(); }
CassandraFeedbackRepository implements FeedbackRepository { @Override public List<UserFeedback> getAllUserFeedback() { LOGGER.debug("Getting all user feedbacks "); List<UserFeedback> feedbacks = new ArrayList<>(); try { Result<com.intuit.wasabi.repository.cassandra.pojo.UserFeedback> result = userFeedbackAccessor.getAllUserFeedback(); feedbacks = makeFeedbacksFromResult(result); } catch (Exception e) { LOGGER.error("Error while getting all user feedback", e); throw new RepositoryException("Could not retrieve feedback from all users", e); } return feedbacks; } @Inject  CassandraFeedbackRepository(UserFeedbackAccessor userFeedbackAccessor); @Override void createUserFeedback(UserFeedback userFeedback); @Override List<UserFeedback> getUserFeedback(UserInfo.Username username); @Override List<UserFeedback> getAllUserFeedback();  }