BroadcastingConverter extends AbstractConverter<BroadcastingMessage, BroadcastingMessageResource> { @Override public BroadcastingMessageResource convert(final BroadcastingMessage source, final BroadcastingMessageResource target) { target.setId(source.getId()); target.setContent(source.getContent()); target.setTopic(source.getTopic()); return target; }  @Override BroadcastingMessageResource convert(final BroadcastingMessage source, final BroadcastingMessageResource target); @Override BroadcastingMessageResource convert(final BroadcastingMessage source);  }
@Test public void testConvert() throws Exception { String topic = "topic"; String content = "content"; BroadcastingMessage source = new BroadcastingMessage(); source.setContent(content); source.setTopic(topic); BroadcastingMessageResource expected = new BroadcastingMessageResource(); expected.setTopic(topic); expected.setContent(content); BroadcastingMessageResource actual = unit.convert(source); assertEquals(expected, actual); }
@Test public void testConvertWithEmptyFields() throws Exception { BroadcastingMessage source = new BroadcastingMessage(); BroadcastingMessageResource expected = new BroadcastingMessageResource(); BroadcastingMessageResource actual = unit.convert(source); assertEquals(expected, actual); }