### Question:
JpaPageLayoutRepository implements PageLayoutRepository { @Override public JpaPageLayout getByPageLayoutCode(String codename){ TypedQuery<JpaPageLayout>query = manager.createNamedQuery(JpaPageLayout.PAGELAYOUT_GET_BY_LAYOUT_CODE,JpaPageLayout.class); query.setParameter("code",codename); return getSingleResult(query.getResultList()); }  @Override JpaPageLayout 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);  }### Answer:
@Test public void getByPageLayoutCode() { JpaPageLayout pageLayout = (JpaPageLayout)repository.getByPageLayoutCode(VALID_LAYOUT_CODE); assertThat(pageLayout.getCode(), is(VALID_LAYOUT_CODE)); assertThat(pageLayout.getNumberOfRegions(), is(2L)); assertThat(pageLayout.getEntityId(), is(notNullValue(Long.class))); }
@Test public void getByPageLayoutCode_invalidCode() { assertThat((JpaPageLayout)repository.getByPageLayoutCode(INVALID_LAYOUT_CODE), is(nullValue(JpaPageLayout.class))); }