### Question:
MongoDbAuthorityRepository implements AuthorityRepository { @Override public void delete(Authority item) { template.remove(getByAuthority(item.getAuthority()), AUTHORITY_COLLECTION); }  @Override Authority getByAuthority(String authorityName); @Override List<Authority> getAll(); @Override List<Authority> getLimitedList(int offset, int limit); @Override List<Authority> getAllDefault(); @Override int getCountAll(); @Override Class<? extends Authority> getType(); @Override Authority get(String id); @Override Authority save(Authority item); @Override void delete(Authority item); void setTemplate(MongoOperations template); void setConverter(HydratingConverterFactory converter); MongoOperations getTemplate(); HydratingConverterFactory getConverter(); static final Class<MongoDbAuthority> CLASS; }### Answer:
@Test public void delete(){ Authority deleted = new MongoDbAuthority(); deleted.setAuthority("deleted"); template.remove(isA(Authority.class), eq(AUTHORITY_COLLECTION)); expectLastCall(); expect(template.findOne(query(where("authority").is("deleted")), CLASS, AUTHORITY_COLLECTION)).andReturn((MongoDbAuthority)deleted); replay(template); repo.delete(deleted); verify(template); }