PresentationEntityMapper { @Contract("null -> null") public PresentationStripe transform(final @Nullable DomainStripe domainStripe) { PresentationStripe ret = null; if (domainStripe != null) { ret = new PresentationStripe(); ret.setAlt(domainStripe.getAlt()); ret.setDay(domainStripe.getDay()); ret.setImg(domainStripe.getImg()); ret.setLink(domainStripe.getLink()); ret.setMonth(domainStripe.getMonth()); ret.setNews(domainStripe.getNews()); ret.setNum(domainStripe.getNum()); ret.setSafe_title(domainStripe.getSafe_title()); ret.setTitle(domainStripe.getTitle()); ret.setTranscript(domainStripe.getTranscript()); ret.setYear(domainStripe.getYear()); } return ret; } @Inject  PresentationEntityMapper(); @Contract("null -> null") PresentationStripe transform(final @Nullable DomainStripe domainStripe); @Contract("null -> null") DomainStripe transform(final @Nullable PresentationStripe presentationStripe);  }
@Test public void testTransformFromDomainNull() { assertThat(mSut.transform((DomainStripe) null)).isNull(); }
@Test public void testTransformFromPresentationNull() { assertThat(mSut.transform((PresentationStripe) null)).isNull(); }
@Test public void testTransformFromDomainAllFieldsNull() { final DomainStripe source = new DomainStripe(); 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)); }
@Test public void testTransformFromPresentationAllFieldsNull() { final PresentationStripe source = new PresentationStripe(); 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(mSut.transform(source), source); }
@Test public void testTransformFromPresentationAllFieldsRegular() { final PresentationStripe source = new PresentationStripe(); 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(mSut.transform(source), source); }