BodyError extends CompactComponent<BodyErrorProps, ActionDispatcher> { public String getDescription(final Context context) { final PaymentResultViewModel viewModel = PaymentResultViewModelFactory .createPaymentStatusWithProps(props.status, props.statusDetail, props); return viewModel.getDescription(context); } BodyError(@NonNull final BodyErrorProps props, @NonNull final ActionDispatcher dispatcher); String getTitle(final Context context); String getDescription(final Context context); @Override View render(@NonNull final ViewGroup parent);  }
@Test public void testBodyErrorTitleOnEmptyCase() { final PaymentResult paymentResult = PaymentResults.getStatusRejectedBadFilledFormPaymentResult(); final BodyError bodyError = new BodyError(getBodyErrorProps(paymentResult), dispatcher); assertEquals("", bodyError.getDescription(context)); }
@Test public void testBodyErrorDescriptionForPendingContingency() { final PaymentResult paymentResult = PaymentResults.getStatusInProcessContingencyPaymentResult(); final BodyError bodyError = new BodyError(getBodyErrorProps(paymentResult), dispatcher); assertEquals(CONTINGENCY_DESCRIPTION, bodyError.getDescription(context)); }
@Test public void testBodyErrorDescriptionForPendingReviewManual() { final PaymentResult paymentResult = PaymentResults.getStatusInProcessReviewManualPaymentResult(); final BodyError bodyError = new BodyError(getBodyErrorProps(paymentResult), dispatcher); assertEquals(REVIEW_MANUAL_DESCRIPTION, bodyError.getDescription(context)); }
@Test public void testBodyErrorDescriptionForRejectedCallForAuth() { final PaymentResult paymentResult = PaymentResults.getStatusCallForAuthPaymentResult(); final BodyError bodyError = new BodyError(getBodyErrorProps(paymentResult), dispatcher); assertEquals(CALL_FOR_AUTH_DESCRIPTION_1 + TextUtil.NL + CALL_FOR_AUTH_DESCRIPTION_2, bodyError.getDescription(context)); }
@Test public void testBodyErrorDescriptionForRejectedInsufficientAmount() { final PaymentResult paymentResult = PaymentResults.getStatusRejectedInsufficientAmountPaymentResult(); final BodyError bodyError = new BodyError(getBodyErrorProps(paymentResult), dispatcher); assertEquals(REJECTED_INSUFFICIENT_AMOUNT_1 + TextUtil.NL + REJECTED_INSUFFICIENT_AMOUNT_2, bodyError.getDescription(context)); }
@Test public void testBodyErrorDescriptionForRejectedOtherReason() { final PaymentResult paymentResult = PaymentResults.getStatusRejectedOtherPaymentResult(); final BodyError bodyError = new BodyError(getBodyErrorProps(paymentResult), dispatcher); assertEquals(EMPTY_DESCRIPTION, bodyError.getDescription(context)); }
@Test public void testBodyErrorDescriptionForRejectedInsufficientData() { final PaymentResult paymentResult = PaymentResults.getBoletoRejectedPaymentResult(); final BodyError bodyError = new BodyError(getBodyErrorProps(paymentResult), dispatcher); assertEquals(REJECTED_INSUFFICIENT_DATA, bodyError.getDescription(context)); }
@Test public void testBodyErrorDescriptionForRejectedDuplicatedPayment() { final PaymentResult paymentResult = PaymentResults.getStatusRejectedDuplicatedPaymentResult(); final BodyError bodyError = new BodyError(getBodyErrorProps(paymentResult), dispatcher); assertEquals(DUPLICATED_DESCRIPTION, bodyError.getDescription(context)); }
@Test public void testBodyErrorDescriptionOnEmptyCase() { final PaymentResult paymentResult = PaymentResults.getStatusRejectedBadFilledFormPaymentResult(); final BodyError bodyError = new BodyError(getBodyErrorProps(paymentResult), dispatcher); assertEquals(TextUtil.EMPTY, bodyError.getDescription(context)); }
@Test public void testBodyErrorHasActionForCallForAuth() { final PaymentResult paymentResult = PaymentResults.getStatusCallForAuthPaymentResult(); final BodyError bodyError = new BodyError(getBodyErrorProps(paymentResult), dispatcher); assertEquals(CALL_FOR_AUTH_DESCRIPTION_1 + TextUtil.NL + CALL_FOR_AUTH_DESCRIPTION_2, bodyError.getDescription(context)); }
@Test public void testBodyErrorDoestHaveActionForOtherRejected() { final PaymentResult paymentResult = PaymentResults.getStatusRejectedOtherPaymentResult(); final BodyError bodyError = new BodyError(getBodyErrorProps(paymentResult), dispatcher); assertNotEquals(CALL_FOR_AUTH_DESCRIPTION_1 + TextUtil.NL + CALL_FOR_AUTH_DESCRIPTION_2, bodyError.getDescription(context)); }
@Test public void testBodyErrorDescriptionForRejectedMaxAttempts() { final PaymentResult paymentResult = PaymentResults.getStatusRejectedMaxAttemptsPaymentResult(); final BodyError bodyError = new BodyError(getBodyErrorProps(paymentResult), dispatcher); assertEquals(MAX_ATTEMPTS_DESCRIPTION, bodyError.getDescription(context)); }