DomainEntityMapper { @Contract("null -> null") public DomainStripe transform(final @Nullable DataStripe dataStripe) { DomainStripe ret = null; if (dataStripe != null) { ret = new DomainStripe(); ret.setAlt(dataStripe.getAlt()); ret.setDay(dataStripe.getDay()); ret.setImg(dataStripe.getImg()); ret.setLink(dataStripe.getLink()); ret.setMonth(dataStripe.getMonth()); ret.setNews(dataStripe.getNews()); ret.setNum(dataStripe.getNum()); ret.setSafe_title(dataStripe.getSafe_title()); ret.setTitle(dataStripe.getTitle()); ret.setTranscript(dataStripe.getTranscript()); ret.setYear(dataStripe.getYear()); } return ret; } @Inject  DomainEntityMapper(); @Contract("null -> null") DomainStripe transform(final @Nullable DataStripe dataStripe);  }
@Test public void testTransformDataAllFieldsRegular() { final DataStripe source = new DataStripe(); source.setAlt(generateString(Value.REGULAR)); source.setDay(generateString(Value.REGULAR)); source.setImg(generateString(Value.REGULAR)); source.setLink(generateString(Value.REGULAR)); source.setMonth(generateString(Value.REGULAR)); source.setYear(generateString(Value.REGULAR)); source.setNews(generateString(Value.REGULAR)); source.setNum(generateLong(Value.REGULAR)); source.setTitle(generateString(Value.REGULAR)); source.setSafe_title(generateString(Value.REGULAR)); source.setTranscript(generateString(Value.REGULAR)); assertEquivalent(source, mSut.transform(source)); }
@Test public void testTransformNull() { assertThat(mSut.transform(null)).isNull(); }
@Test public void testTransformDataAllFieldsNull() { final DataStripe source = new DataStripe(); source.setAlt(generateString(Value.NULL)); source.setDay(generateString(Value.NULL)); source.setImg(generateString(Value.NULL)); source.setLink(generateString(Value.NULL)); source.setMonth(generateString(Value.NULL)); source.setYear(generateString(Value.NULL)); source.setNews(generateString(Value.NULL)); source.setNum(generateLong(Value.NULL)); source.setTitle(generateString(Value.NULL)); source.setSafe_title(generateString(Value.NULL)); source.setTranscript(generateString(Value.NULL)); assertEquivalent(source, mSut.transform(source)); }