BodyError extends CompactComponent<BodyErrorProps, ActionDispatcher> { public String getTitle(final Context context) { final PaymentResultViewModel viewModel = PaymentResultViewModelFactory .createPaymentResultViewModel(props.status, props.statusDetail); if (viewModel.hasBodyTitle()) { return viewModel.getBodyTitle(context); } return TextUtil.EMPTY; } 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 testBodyErrorTitleForCallForAuth() { final PaymentResult paymentResult = PaymentResults.getStatusCallForAuthPaymentResult(); final BodyError bodyError = new BodyError(getBodyErrorProps(paymentResult), dispatcher); assertEquals(CALL_FOR_AUTH_ERROR_TITLE, bodyError.getTitle(context)); }
@Test public void testBodyErrorTitleForInsufficientAmount() { final PaymentResult paymentResult = PaymentResults.getStatusRejectedInsufficientAmountPaymentResult(); final BodyError bodyError = new BodyError(getBodyErrorProps(paymentResult), dispatcher); assertEquals(ERROR_TITLE, bodyError.getTitle(context)); }
@Test public void testBodyErrorTitleForRejectedOther() { final PaymentResult paymentResult = PaymentResults.getStatusRejectedOtherPaymentResult(); final BodyError bodyError = new BodyError(getBodyErrorProps(paymentResult), dispatcher); assertEquals(TextUtil.EMPTY, bodyError.getTitle(context)); }
@Test public void testBodyErrorTitleForInsufficientData() { final PaymentResult paymentResult = PaymentResults.getBoletoRejectedPaymentResult(); final BodyError bodyError = new BodyError(getBodyErrorProps(paymentResult), dispatcher); assertEquals(ERROR_TITLE, bodyError.getTitle(context)); }
@Test public void testBodyErrorTitleForDuplicatedPayment() { final PaymentResult paymentResult = PaymentResults.getStatusRejectedDuplicatedPaymentResult(); final BodyError bodyError = new BodyError(getBodyErrorProps(paymentResult), dispatcher); assertEquals("", bodyError.getTitle(context)); }
@Test public void testBodyErrorTitleForPendingContingency() { final PaymentResult paymentResult = PaymentResults.getStatusInProcessContingencyPaymentResult(); final BodyError bodyError = new BodyError(getBodyErrorProps(paymentResult), dispatcher); assertEquals(TextUtil.EMPTY, bodyError.getTitle(context)); }