@Test public void testNotSaved() { final Long activityId = 2L; final Long personId = 1L; final ActivityDTO activity = new ActivityDTO(); activity.setId(activityId); final PersonModelView user = new PersonModelView(); user.setEntityId(personId); final List<ActivityDTO> activities = Arrays.asList(activity); final List<Long> starredActivities = Arrays.asList(3L); CONTEXT.checking(new Expectations() { { oneOf(starredMapper).execute(personId); will(returnValue(starredActivities)); } }); sut.filter(activities, user); Assert.assertFalse(activity.isStarred()); CONTEXT.assertIsSatisfied(); }
public void filter(final List<ActivityDTO> activities, final PersonModelView user) { List<Long> starred = starredActivitiesMapper.execute(user.getEntityId()); for (ActivityDTO activity : activities) { activity.setStarred(starred.contains(activity.getId())); } }
PopulateActivityDTOSavedData implements ActivityFilter { public void filter(final List<ActivityDTO> activities, final PersonModelView user) { List<Long> starred = starredActivitiesMapper.execute(user.getEntityId()); for (ActivityDTO activity : activities) { activity.setStarred(starred.contains(activity.getId())); } } }
PopulateActivityDTOSavedData implements ActivityFilter { public void filter(final List<ActivityDTO> activities, final PersonModelView user) { List<Long> starred = starredActivitiesMapper.execute(user.getEntityId()); for (ActivityDTO activity : activities) { activity.setStarred(starred.contains(activity.getId())); } } PopulateActivityDTOSavedData(final GetStarredActivityIds inStarredActivitiesMapper); }
PopulateActivityDTOSavedData implements ActivityFilter { public void filter(final List<ActivityDTO> activities, final PersonModelView user) { List<Long> starred = starredActivitiesMapper.execute(user.getEntityId()); for (ActivityDTO activity : activities) { activity.setStarred(starred.contains(activity.getId())); } } PopulateActivityDTOSavedData(final GetStarredActivityIds inStarredActivitiesMapper); void filter(final List<ActivityDTO> activities, final PersonModelView user); }
PopulateActivityDTOSavedData implements ActivityFilter { public void filter(final List<ActivityDTO> activities, final PersonModelView user) { List<Long> starred = starredActivitiesMapper.execute(user.getEntityId()); for (ActivityDTO activity : activities) { activity.setStarred(starred.contains(activity.getId())); } } PopulateActivityDTOSavedData(final GetStarredActivityIds inStarredActivitiesMapper); void filter(final List<ActivityDTO> activities, final PersonModelView user);  }