MarkScaleValueResourceConverter extends AbstractConverter<MarkScaleValueResource, MarkScaleValue> { @Override public MarkScaleValue convert(final MarkScaleValueResource source, final MarkScaleValue target) { if (source.getMarkScaleId() != null) { MarkScale markScale = new MarkScale(); markScale.setId(source.getMarkScaleId()); target.setMarkScale(markScale); } target.setStrValue(source.getStrValue()); return target; }  @Override MarkScaleValue convert(final MarkScaleValueResource source, final MarkScaleValue target); @Override MarkScaleValue convert(final MarkScaleValueResource source);  }
@Test public void testConvert() throws Exception { String strValue = "strValue"; Long markscaleId = 1L; MarkScale markscale = new MarkScale(); markscale.setId(markscaleId); MarkScaleValueResource source = new MarkScaleValueResource(); source.setStrValue(strValue); source.setMarkScaleId(markscaleId); MarkScaleValue expected = new MarkScaleValue(); expected.setStrValue(strValue); expected.setMarkScale(markscale); MarkScaleValue actual = unit.convert(source); assertEquals(expected, actual); }
@Test public void testConvertWithNoRelations() throws Exception { String strValue = "strValue"; MarkScaleValueResource source = new MarkScaleValueResource(); source.setStrValue(strValue); MarkScaleValue expected = new MarkScaleValue(); expected.setStrValue(strValue); MarkScaleValue actual = unit.convert(source); assertEquals(expected, actual); }