### Question:
JpaPageConverter implements ModelConverter<Page, JpaPage> { @Override public JpaPage convert(Page source) { if (source != null) { source.setPageType(source.getPageType() == null ? null : source.getPageType().toUpperCase()); return source instanceof JpaPage ? (JpaPage) source : createEntity(source); } return null; }  @Override Class<Page> getSourceType(); @Override JpaPage convert(Page source);  }### Answer:
@Test public void noConversion() { Page page = new JpaPage(); assertThat(pageConverter.convert(page), is(sameInstance(page))); }
@Test public void nullConversion() { Page page = null; assertThat(pageConverter.convert(page), is(nullValue())); }
@Test public void newPage() { Page page = new PageImpl(); page.setId("1"); page.setMembers(new ArrayList<PageUser>()); page.setName("name"); page.setOwnerId(""); page.setContextId("context"); page.setPageLayout(new PageLayoutImpl()); page.setPageType(PageType.USER.toString()); page.setParentPage(new PageImpl("1")); page.setRegions(new ArrayList<Region>()); page.setSubPages(new ArrayList<Page>()); page.setProperties(new HashMap<String, Object>()); JpaPage converted = pageConverter.convert(page); assertThat(converted, is(not(sameInstance(page)))); assertThat(converted, is(instanceOf(JpaPage.class))); assertThat(converted.getId(), is(equalTo(page.getId()))); assertThat(converted.getParentPage().getId(), is(equalTo(page.getParentPage().getId()))); assertThat(converted.getRegions(), is(equalTo(page.getRegions()))); assertThat(converted.getMembers(), is(equalTo(page.getMembers()))); assertThat(converted.getName(), is(equalTo(page.getName()))); assertThat(converted.getOwnerId(), is(equalTo(page.getOwnerId()))); assertThat(converted.getContextId(), is(equalTo(page.getContextId()))); assertThat(converted.getPageLayout().getCode(), is(equalTo(page.getPageLayout().getCode()))); assertThat(converted.getPageType(), is(equalTo(page.getPageType()))); assertThat(converted.getSubPages(), is(equalTo(page.getSubPages()))); assertThat(converted.getProperties(), is(equalTo(page.getProperties()))); }