### Question:
MongoDbTagRepository implements TagRepository { @Override public Tag getByKeyword(String keyword) { return template.findOne(query(where("keyword").is(keyword))); }  @Override List<Tag> getAll(); @Override List<Tag> getLimitedList(int offset, int pageSize); @Override int getCountAll(); @Override Tag getByKeyword(String keyword); @Override Class<? extends Tag> getType(); @Override Tag get(String id); @Override Tag save(Tag item); @Override void delete(Tag item); void setWidgetTemplate(MongoTagOperations tagTemplate);  }### Answer:
@Test public void getByKeyword() { String keyword = "key"; Tag t = new TagImpl("1", keyword); expect(tagTemplate.findOne(Query.query(Criteria.where("keyword").is(keyword)))).andReturn(t); replay(tagTemplate); Tag fromRepo = repo.getByKeyword(keyword); assertThat(fromRepo.getKeyword(), is(equalTo(keyword))); }