@Test public void isCvcMaximalLength_whenTooManyDigits_returnsFalse() { assertFalse(ViewUtils.isCvcMaximalLength(Card.AMERICAN_EXPRESS, "12345")); assertFalse(ViewUtils.isCvcMaximalLength(Card.VISA, "1234")); assertFalse(ViewUtils.isCvcMaximalLength(Card.MASTERCARD, "123456")); assertFalse(ViewUtils.isCvcMaximalLength(Card.DINERS_CLUB, "1234567")); assertFalse(ViewUtils.isCvcMaximalLength(Card.DISCOVER, "12345678")); assertFalse(ViewUtils.isCvcMaximalLength(Card.JCB, "123456789012345")); }
static boolean isCvcMaximalLength( @NonNull @Card.CardBrand String cardBrand, @Nullable String cvcText) { if (cvcText == null) { return false; } if (Card.AMERICAN_EXPRESS.equals(cardBrand)) { return cvcText.trim().length() == CVC_LENGTH_AMERICAN_EXPRESS; } else { return cvcText.trim().length() == CVC_LENGTH_COMMON; } }
ViewUtils { static boolean isCvcMaximalLength( @NonNull @Card.CardBrand String cardBrand, @Nullable String cvcText) { if (cvcText == null) { return false; } if (Card.AMERICAN_EXPRESS.equals(cardBrand)) { return cvcText.trim().length() == CVC_LENGTH_AMERICAN_EXPRESS; } else { return cvcText.trim().length() == CVC_LENGTH_COMMON; } } }
ViewUtils { static boolean isCvcMaximalLength( @NonNull @Card.CardBrand String cardBrand, @Nullable String cvcText) { if (cvcText == null) { return false; } if (Card.AMERICAN_EXPRESS.equals(cardBrand)) { return cvcText.trim().length() == CVC_LENGTH_AMERICAN_EXPRESS; } else { return cvcText.trim().length() == CVC_LENGTH_COMMON; } }  }
ViewUtils { static boolean isCvcMaximalLength( @NonNull @Card.CardBrand String cardBrand, @Nullable String cvcText) { if (cvcText == null) { return false; } if (Card.AMERICAN_EXPRESS.equals(cardBrand)) { return cvcText.trim().length() == CVC_LENGTH_AMERICAN_EXPRESS; } else { return cvcText.trim().length() == CVC_LENGTH_COMMON; } }   }
ViewUtils { static boolean isCvcMaximalLength( @NonNull @Card.CardBrand String cardBrand, @Nullable String cvcText) { if (cvcText == null) { return false; } if (Card.AMERICAN_EXPRESS.equals(cardBrand)) { return cvcText.trim().length() == CVC_LENGTH_AMERICAN_EXPRESS; } else { return cvcText.trim().length() == CVC_LENGTH_COMMON; } }    }