### Question:
JpaPageTemplateWidgetConverter implements ModelConverter<PageTemplateWidget, JpaPageTemplateWidget> { @Override public JpaPageTemplateWidget convert(PageTemplateWidget source) { return source instanceof JpaPageTemplateWidget ? (JpaPageTemplateWidget) source : createEntity(source); }  @Override Class<PageTemplateWidget> getSourceType(); @Override JpaPageTemplateWidget convert(PageTemplateWidget source);  }### Answer:
@Test public void testNoConversion() { JpaPageTemplateWidget template = new JpaPageTemplateWidget(); assertThat(converter.convert(template), is(sameInstance(template))); }
@Test public void nullConversion() { PageTemplateWidget template = null; assertThat(converter.convert(template), is(nullValue())); }
@Test public void convertValid() { JpaWidget widget = new JpaWidget(); widget.setEntityId(1L); PageTemplateWidget template = new PageTemplateWidgetImpl("1"); template.setLocked(true); template.setHideChrome(true); template.setPageTemplateRegion(new PageTemplateRegionImpl("1")); template.setRenderSeq(1); template.setWidgetId(widget.getId()); JpaPageTemplateWidget jpaTemplate = converter.convert(template); assertThat(jpaTemplate, is(not(sameInstance(template)))); assertThat(jpaTemplate, is(instanceOf(JpaPageTemplateWidget.class))); assertThat(jpaTemplate.isLocked(), is(equalTo(template.isLocked()))); assertThat(jpaTemplate.getPageTemplateRegion(), is(instanceOf(JpaPageTemplateRegion.class))); assertThat(jpaTemplate.getRenderSeq(), is(equalTo(template.getRenderSeq()))); assertThat(jpaTemplate.getWidgetId(), is(equalTo(template.getWidgetId()))); assertThat(jpaTemplate.isLocked(), is(equalTo(template.isLocked()))); assertThat(jpaTemplate.isHideChrome(), is(equalTo(template.isHideChrome()))); }