### Question:
DefaultCategoryService implements CategoryService { @Override public SearchResult<Category> getAll() { final int count = categoryRepository.getCountAll(); final List<Category> categories = categoryRepository.getAll(); return new SearchResult<Category>(categories, count); } @Autowired  DefaultCategoryService(CategoryRepository categoryRepository); @Override Category get(String id); @Override List<Category> getAllList(); @Override SearchResult<Category> getAll(); @Override SearchResult<Category> getLimitedList(int offset, int pageSize); @Override @Transactional Category create(String text, User createdUser); @Override @Transactional Category update(String categoryId, String text, User lastModifiedUser); @Override @Transactional void delete(Category category);  }### Answer:
@Test public void getAll(){ List<Category> categories = new ArrayList<Category>(); expect(repository.getAll()).andReturn(categories); expect(repository.getCountAll()).andReturn(1); replay(repository); List<Category> result = service.getAll().getResultSet(); assertThat(result, is(sameInstance(categories))); }