### Question:
JpaCategoryConverter implements ModelConverter<Category, JpaCategory> { @Override public JpaCategory convert(Category source) { return source instanceof JpaCategory ? (JpaCategory) source : createEntity(source); }  @Override Class<Category> getSourceType(); @Override JpaCategory convert(Category source);  }### Answer:
@Test public void noConversion() { Category category = new JpaCategory(); assertThat(categoryConverter.convert(category), is(sameInstance(category))); }
@Test public void nullConversion() { Category category = null; assertThat(categoryConverter.convert(category), is(nullValue())); }
@Test public void newCategory() { Category category = new CategoryImpl(); category.setCreatedDate(new Date()); category.setId("9"); category.setLastModifiedDate(new Date()); category.setText("hello"); category.setCreatedUserId("1"); category.setLastModifiedUserId("1"); category.setWidgets(new ArrayList<Widget>()); JpaCategory converted = categoryConverter.convert(category); assertThat(converted, is(not(sameInstance(category)))); assertThat(converted, is(instanceOf(JpaCategory.class))); assertThat(converted.getCreatedDate(), is(equalTo(category.getCreatedDate()))); assertThat(converted.getCreatedUserId(), is(equalTo(category.getCreatedUserId()))); assertThat(converted.getEntityId().toString(), is(equalTo(category.getId()))); assertThat(converted.getId(), is(equalTo(category.getId()))); assertThat(converted.getLastModifiedDate(), is(equalTo(category.getLastModifiedDate()))); assertThat(converted.getLastModifiedUserId(), is(equalTo(category.getLastModifiedUserId()))); assertThat(converted.getText(), is(equalTo(category.getText()))); assertThat(converted.getWidgets(), is(equalTo(category.getWidgets()))); }