### Question:
DefaultPortalPreferenceService implements PortalPreferenceService { @Override public SearchResult<PortalPreference> getAll() { final int count = repository.getCountAll(); final List<PortalPreference> portalPreferences = repository.getAll(); return new SearchResult<PortalPreference>(portalPreferences, count); } @Autowired  DefaultPortalPreferenceService(PortalPreferenceRepository repository, RaveEventManager manager); @Override Map<String, PortalPreference> getPreferencesAsMap(); @Override PortalPreference getPreference(String key); @Override SearchResult<PortalPreference> getAll(); @Override SearchResult<PortalPreference> getLimitedList(int offset, int pageSize); @Override @Transactional void savePreference(String key, String value); @Override @Transactional void savePreference(String key, List<String> values); @Override @Transactional void savePreference(PortalPreference preference);  }### Answer:
@Test public void getAll() { List<PortalPreference> portalPreferences = new ArrayList<PortalPreference>(); expect(repository.getCountAll()).andReturn(1); expect(repository.getAll()).andReturn(portalPreferences); replay(repository); List<PortalPreference> result = service.getAll().getResultSet(); assertThat(result, is(sameInstance(portalPreferences))); verify(repository); }