### Question:
JpaActivityStreamsMediaLinkConverter implements ModelConverter<ActivityStreamsMediaLink, JpaActivityStreamsMediaLink> { @Override public JpaActivityStreamsMediaLink convert(ActivityStreamsMediaLink source) { if(source != null && source.getId() == null) { source.setId(source.getUrl() == null ? UUID.randomUUID().toString() : source.getUrl()); } return source instanceof JpaActivityStreamsMediaLink ? (JpaActivityStreamsMediaLink) source : createEntity(source); }  @Override JpaActivityStreamsMediaLink convert(ActivityStreamsMediaLink source); @Override Class<ActivityStreamsMediaLink> getSourceType();  }### Answer:
@Test public void testNoConversion() { JpaActivityStreamsMediaLink template = new JpaActivityStreamsMediaLink(); assertThat(converter.convert(template), is(sameInstance(template))); }
@Test public void nullConversion() { ActivityStreamsMediaLink template = null; assertThat(converter.convert(template), is(nullValue())); }
@Test public void convertValid() { ActivityStreamsMediaLink template = new ActivityStreamsMediaLinkImpl(); template.setDuration(1); template.setHeight(1); template.setUrl("TEST_C"); template.setWidth(1); JpaActivityStreamsMediaLink jpaTemplate = converter.convert(template); assertThat(jpaTemplate, is(not(sameInstance(template)))); assertThat(jpaTemplate, is(instanceOf(JpaActivityStreamsMediaLink.class))); assertThat(jpaTemplate.getDuration(), is(equalTo(template.getDuration()))); assertThat(jpaTemplate.getHeight(), is(equalTo(template.getHeight()))); assertThat(jpaTemplate.getWidth(), is(equalTo(template.getWidth()))); assertThat(jpaTemplate.getUrl(), is(equalTo(template.getUrl()))); }