PaymentMethodComponent extends CompactComponent<ReviewAndConfirmViewModel, PaymentMethodComponent.Actions> { @VisibleForTesting boolean shouldShowPaymentMethodButton() { return props.hasMoreThanOnePaymentMethod() || PaymentTypes.isCardPaymentType(props.getPaymentType()); } PaymentMethodComponent(final ReviewAndConfirmViewModel props, final Actions actions); @Override View render(@NonNull final ViewGroup parent);  }
@Test public void whenPaymentMethodIsOnlyAvailableAndIsNotCreditCardShouldNotShowPaymentMethodButton() { when(model.getPaymentType()).thenReturn(PaymentTypes.BANK_TRANSFER); when(model.hasMoreThanOnePaymentMethod()).thenReturn(false); assertFalse(component.shouldShowPaymentMethodButton()); }
@Test public void whenPaymentMethodIsOnlyAvailableAndIsCreditCardShouldShowPaymentMethodButton() { when(model.getPaymentType()).thenReturn(PaymentTypes.CREDIT_CARD); when(model.hasMoreThanOnePaymentMethod()).thenReturn(false); assertTrue(component.shouldShowPaymentMethodButton()); }
@Test public void whenPaymentMethodIsNotOnlyAvailableShowPaymentMethodButton() { when(model.hasMoreThanOnePaymentMethod()).thenReturn(true); assertTrue(component.shouldShowPaymentMethodButton()); }