### Question:
JpaPortalPreferenceConverter implements ModelConverter<PortalPreference, JpaPortalPreference> { @Override public JpaPortalPreference convert(PortalPreference source) { return source instanceof JpaPortalPreference ? (JpaPortalPreference) source : createEntity(source); }  @Override Class<PortalPreference> getSourceType(); @Override JpaPortalPreference convert(PortalPreference source);  }### Answer:
@Test public void testNoConversion() { JpaPortalPreference template = new JpaPortalPreference(); assertThat(converter.convert(template), is(sameInstance(template))); }
@Test public void nullConversion() { PortalPreference template = null; assertThat(converter.convert(template), is(nullValue())); }
@Test public void convertValid() { PortalPreference template = new PortalPreferenceImpl(); template.setKey("KEY"); template.setValue("VALUE"); JpaPortalPreference jpaTemplate = converter.convert(template); assertThat(jpaTemplate, is(not(sameInstance(template)))); assertThat(jpaTemplate, is(instanceOf(JpaPortalPreference.class))); assertThat(jpaTemplate.getKey(), is(equalTo(template.getKey()))); assertThat(jpaTemplate.getValue(), is(equalTo(template.getValue()))); }