### Question:
JpaAuthorityConverter implements ModelConverter<Authority, JpaAuthority> { @Override public JpaAuthority convert(Authority source) { return source instanceof JpaAuthority ? (JpaAuthority) source : createEntity(source); }  @Override Class<Authority> getSourceType(); @Override JpaAuthority convert(Authority source);  }### Answer:
@Test public void testNoConversion() { JpaAuthority template = new JpaAuthority(); assertThat(converter.convert(template), is(sameInstance(template))); }
@Test public void nullConversion() { Authority template = null; assertThat(converter.convert(template), is(nullValue())); }
@Test public void convertValid() { Authority template = new AuthorityImpl(); template.setAuthority("FOO"); template.setDefaultForNewUser(true); template.addUser(new UserImpl("42")); JpaAuthority jpaTemplate = converter.convert(template); assertThat(jpaTemplate, is(not(sameInstance(template)))); assertThat(jpaTemplate, is(instanceOf(JpaAuthority.class))); assertThat(jpaTemplate.getAuthority(), is(equalTo(template.getAuthority()))); assertThat(jpaTemplate.isDefaultForNewUser(), is(equalTo(template.isDefaultForNewUser()))); assertThat(jpaTemplate.getUsers().iterator().next().getId(), is(equalTo(template.getUsers().iterator().next().getId()))); }