### Question:
DefaultTagService implements TagService { @Override public SearchResult<Tag> getLimitedList(int offset, int pageSize) { final int count = repository.getCountAll(); final List<Tag> tags = repository.getLimitedList(offset, pageSize); final SearchResult<Tag> searchResult = new SearchResult<Tag>(tags, count); searchResult.setOffset(offset); searchResult.setPageSize(pageSize); return searchResult; } @Autowired  DefaultTagService(TagRepository repository); @Override Tag getTagById(String entityId); @Override List<Tag> getAllTagsList(); @Override SearchResult<Tag> getAll(); @Override SearchResult<Tag> getLimitedList(int offset, int pageSize); @Override Tag getTagByKeyword(String keyword); @Override @Transactional Tag save(Tag tag);  }### Answer:
@Test public void getLimitedList() { Tag tag1 = new TagImpl("1", "tag"); Tag tag2 = new TagImpl("2", "fakeTag"); List<Tag> tags = new ArrayList<Tag>(); tags.add(tag1); tags.add(tag2); final int pageSize = 10; expect(repository.getCountAll()).andReturn(2); expect(repository.getLimitedList(0, pageSize)).andReturn(tags); replay(repository); SearchResult<Tag> result = service.getLimitedList(0, pageSize); assertEquals(pageSize, result.getPageSize()); assertSame(tags, result.getResultSet()); verify(repository); }