### Question:
MongoDbPageLayoutRepository implements PageLayoutRepository { @Override public void delete(PageLayout item) { template.remove(getByPageLayoutCode(item.getCode())); }  @Override PageLayout getByPageLayoutCode(String codename); @Override List<PageLayout> getAll(); @Override List<PageLayout> getLimitedList(int offset, int limit); @Override int getCountAll(); @Override List<PageLayout> getAllUserSelectable(); @Override Class<? extends PageLayout> getType(); @Override PageLayout get(String id); @Override PageLayout save(PageLayout item); @Override void delete(PageLayout item); void setTemplate(MongoOperations template); static final Class<MongoDbPageLayout> CLASS; }### Answer:
@Test public void delete_Valid(){ PageLayout item = new MongoDbPageLayout(); item.setCode("123"); expect(template.findOne(new Query(where("code").is(item.getCode())), pageLayoutRepository.CLASS, CollectionNames.PAGE_LAYOUT_COLLECTION)).andReturn((MongoDbPageLayout)item); template.remove(item); expectLastCall(); replay(template); pageLayoutRepository.delete(item); verify(template); }