### Question:
JpaRegionWidgetConverter implements ModelConverter<RegionWidget, JpaRegionWidget> { @Override public JpaRegionWidget convert(RegionWidget source) { return source instanceof JpaRegionWidget ? (JpaRegionWidget) source : createEntity(source); }  @Override Class<RegionWidget> getSourceType(); @Override JpaRegionWidget convert(RegionWidget source);  }### Answer:
@Test public void noConversion() { RegionWidget rw = new JpaRegionWidget(); assertThat(regionWidgetConverter.convert(rw), is(sameInstance(rw))); }
@Test public void nullConversion() { RegionWidget template = null; assertThat(regionWidgetConverter.convert(template), is(nullValue())); }
@Test public void newRegion() { RegionWidget rw = new RegionWidgetImpl("9"); rw.setLocked(false); rw.setCollapsed(false); rw.setHideChrome(true); rw.setRenderOrder(9); rw.setPreferences(new ArrayList<RegionWidgetPreference>()); rw.setRegion(new RegionImpl("1")); rw.setRenderPosition("last"); rw.setWidgetId("1"); JpaRegionWidget converted = regionWidgetConverter.convert(rw); assertThat(converted, is(not(sameInstance(rw)))); assertThat(converted, is(instanceOf(JpaRegionWidget.class))); assertThat(converted.getPreferences(), is(equalTo(rw.getPreferences()))); assertThat(converted.getEntityId().toString(), is(equalTo(rw.getId()))); assertThat(converted.getId(), is(equalTo(rw.getId()))); assertThat(converted.isCollapsed(), is(equalTo(rw.isCollapsed()))); assertThat(converted.getRenderOrder(), is(equalTo(rw.getRenderOrder()))); assertThat(converted.isLocked(), is(equalTo(rw.isLocked()))); assertThat(converted.isHideChrome(), is(equalTo(rw.isHideChrome()))); assertThat(converted.getRegion(), is(instanceOf(JpaRegion.class))); assertThat(converted.getRenderPosition(), is(equalTo(rw.getRenderPosition()))); assertThat(converted.getWidgetId(), is(instanceOf(String.class))); }