### Question:
MongoDbPageTemplate extends PageTemplateImpl { @Override public PageLayout getPageLayout() { PageLayout layout = super.getPageLayout(); if(layout == null) { layout = pageLayoutRepository.getByPageLayoutCode(pageLayoutCode); super.setPageLayout(layout); } return layout; }  void setPageLayoutRepository(PageLayoutRepository pageLayoutRepository); String getPageLayoutCode(); void setPageLayoutCode(String pageLayoutCode); PageLayoutRepository getPageLayoutRepository(); @Override PageLayout getPageLayout();  }### Answer:
@Test public void getPageLayout(){ PageLayout p = new PageLayoutImpl(); template.setPageLayoutCode("stinky"); expect(pageLayoutRepository.getByPageLayoutCode("stinky")).andReturn(p); replay(pageLayoutRepository); assertThat(template.getPageLayout(), is(sameInstance(p))); }