### Question:
JpaWidgetTagConverter { public JpaWidgetTag convert(WidgetTag source, String widgetId) { return source instanceof JpaWidgetTag ? (JpaWidgetTag)source : createEntity(source, widgetId); }  Class<WidgetTag> getSourceType(); JpaWidgetTag convert(WidgetTag source, String widgetId);  }### Answer:
@Test public void convert_valid_widgetTaq(){ JpaWidget widget = new JpaWidget(1L, ""); WidgetTag widgetTag = new WidgetTagImpl(new JpaUser(1L).getId(), new Date(), new JpaTag(1L, "news").getId()); JpaWidgetTag jpaWidgetTag = jpaWidgetTagConverter.convert(widgetTag, widget.getId()); assertNotNull(jpaWidgetTag); assertEquals(widgetTag.getCreatedDate(), jpaWidgetTag.getCreatedDate()); assertEquals(widgetTag.getTagId(), jpaWidgetTag.getTagId()); assertEquals(widgetTag.getUserId(), jpaWidgetTag.getUserId()); assertEquals(widget.getId(), jpaWidgetTag.getWidgetId()); }
@Test public void convert_valid_jpaWidgetTaq(){ JpaWidgetTag widgetTag = new JpaWidgetTag(3); widgetTag.setCreatedDate(new Date()); widgetTag.setUserEntityId(new JpaUser(1L).getEntityId()); widgetTag.setTagEntityId(new JpaTag(1L, "news").getEntityId()); JpaWidgetTag jpaWidgetTag = jpaWidgetTagConverter.convert(widgetTag, "3"); assertNotNull(jpaWidgetTag); assertSame(widgetTag, jpaWidgetTag); }