@Test public void essentialParamMissingExceptionIsThrownWhenTheMandatoryParamsAreMissing() throws Exception { thrown.expect(EssentialParamMissingException.class); thrown.expectMessage("status id purpose imageUrl"); mapper.apply(CreditDataTestUtils.creditDraftRawTestBuilder() .status(null) .id(null) .purposeName(null) .imageUrl(null) .build()); }
@Override @SuppressWarnings("ConstantConditions") public CreditDraft apply(@NonNull final CreditDraftRaw raw) throws Exception { assertEssentialParams(raw); return CreditDraft.builder() .id(raw.id()) .purpose(raw.purposeName()) .amount(raw.amount()) .status(toStatus(raw.status())) .creditRepaymentInfo(mapRepaymentInfo(raw.repaymentInfo())) .imageUrl(raw.imageUrl()) .purposeId(raw.purposeId()) .build(); }
CreditDraftMapper implements Function<CreditDraftRaw, CreditDraft> { @Override @SuppressWarnings("ConstantConditions") public CreditDraft apply(@NonNull final CreditDraftRaw raw) throws Exception { assertEssentialParams(raw); return CreditDraft.builder() .id(raw.id()) .purpose(raw.purposeName()) .amount(raw.amount()) .status(toStatus(raw.status())) .creditRepaymentInfo(mapRepaymentInfo(raw.repaymentInfo())) .imageUrl(raw.imageUrl()) .purposeId(raw.purposeId()) .build(); } }
CreditDraftMapper implements Function<CreditDraftRaw, CreditDraft> { @Override @SuppressWarnings("ConstantConditions") public CreditDraft apply(@NonNull final CreditDraftRaw raw) throws Exception { assertEssentialParams(raw); return CreditDraft.builder() .id(raw.id()) .purpose(raw.purposeName()) .amount(raw.amount()) .status(toStatus(raw.status())) .creditRepaymentInfo(mapRepaymentInfo(raw.repaymentInfo())) .imageUrl(raw.imageUrl()) .purposeId(raw.purposeId()) .build(); } @Inject  CreditDraftMapper(); }
CreditDraftMapper implements Function<CreditDraftRaw, CreditDraft> { @Override @SuppressWarnings("ConstantConditions") public CreditDraft apply(@NonNull final CreditDraftRaw raw) throws Exception { assertEssentialParams(raw); return CreditDraft.builder() .id(raw.id()) .purpose(raw.purposeName()) .amount(raw.amount()) .status(toStatus(raw.status())) .creditRepaymentInfo(mapRepaymentInfo(raw.repaymentInfo())) .imageUrl(raw.imageUrl()) .purposeId(raw.purposeId()) .build(); } @Inject  CreditDraftMapper(); @Override @SuppressWarnings("ConstantConditions") CreditDraft apply(@NonNull final CreditDraftRaw raw); }
CreditDraftMapper implements Function<CreditDraftRaw, CreditDraft> { @Override @SuppressWarnings("ConstantConditions") public CreditDraft apply(@NonNull final CreditDraftRaw raw) throws Exception { assertEssentialParams(raw); return CreditDraft.builder() .id(raw.id()) .purpose(raw.purposeName()) .amount(raw.amount()) .status(toStatus(raw.status())) .creditRepaymentInfo(mapRepaymentInfo(raw.repaymentInfo())) .imageUrl(raw.imageUrl()) .purposeId(raw.purposeId()) .build(); } @Inject  CreditDraftMapper(); @Override @SuppressWarnings("ConstantConditions") CreditDraft apply(@NonNull final CreditDraftRaw raw);  }