### Question:
JpaRegionWidgetPreferenceConverter implements ModelConverter<RegionWidgetPreference, JpaRegionWidgetPreference> { @Override public JpaRegionWidgetPreference convert(RegionWidgetPreference source) { return source instanceof JpaRegionWidgetPreference ? (JpaRegionWidgetPreference) source : createEntity(source); }  @Override Class<RegionWidgetPreference> getSourceType(); @Override JpaRegionWidgetPreference convert(RegionWidgetPreference source);  }### Answer:
@Test public void testNoConversion() { JpaRegionWidgetPreference template = new JpaRegionWidgetPreference(); assertThat(converter.convert(template), is(sameInstance(template))); }
@Test public void nullConversion() { RegionWidgetPreference template = null; assertThat(converter.convert(template), is(nullValue())); }
@Test public void convertValid() { RegionWidgetPreference template = new RegionWidgetPreferenceImpl(); template.setName("TEST_A"); template.setRegionWidgetId("42"); template.setValue("TEST_B"); JpaRegionWidgetPreference jpaTemplate = converter.convert(template); assertThat(jpaTemplate, is(not(sameInstance(template)))); assertThat(jpaTemplate, is(instanceOf(JpaRegionWidgetPreference.class))); assertThat(jpaTemplate.getName(), is(equalTo(template.getName()))); assertThat(jpaTemplate.getRegionWidgetId(), is(equalTo(template.getRegionWidgetId()))); assertThat(jpaTemplate.getValue(), is(equalTo(template.getValue()))); }