@Test public void validateCardNumber_with_a_number_with_less_than_7_digits_fails() { String number = "4242"; this.expectedEx.expect(CreditCard4JException.class); CreditCard4J.validateCardNumber(number); }
public static String validateCardNumber(String cardNumber) { String cleanedNumber = CardNumberCleaner.clean(cardNumber); checkLongerThan("Invalid card number: a card number should have at least 7 digits.", cleanedNumber, MIN_CARD_NUMBER_LENGTH); return Luhn.checkValidity(cleanedNumber); }
CreditCard4J { public static String validateCardNumber(String cardNumber) { String cleanedNumber = CardNumberCleaner.clean(cardNumber); checkLongerThan("Invalid card number: a card number should have at least 7 digits.", cleanedNumber, MIN_CARD_NUMBER_LENGTH); return Luhn.checkValidity(cleanedNumber); } }
CreditCard4J { public static String validateCardNumber(String cardNumber) { String cleanedNumber = CardNumberCleaner.clean(cardNumber); checkLongerThan("Invalid card number: a card number should have at least 7 digits.", cleanedNumber, MIN_CARD_NUMBER_LENGTH); return Luhn.checkValidity(cleanedNumber); }  }
CreditCard4J { public static String validateCardNumber(String cardNumber) { String cleanedNumber = CardNumberCleaner.clean(cardNumber); checkLongerThan("Invalid card number: a card number should have at least 7 digits.", cleanedNumber, MIN_CARD_NUMBER_LENGTH); return Luhn.checkValidity(cleanedNumber); }  static void resetConfig(); static CardBrand getBrand(String cardNumber); static String validateCardNumber(String cardNumber); static boolean isValidCardNumber(String cardNumber); }
CreditCard4J { public static String validateCardNumber(String cardNumber) { String cleanedNumber = CardNumberCleaner.clean(cardNumber); checkLongerThan("Invalid card number: a card number should have at least 7 digits.", cleanedNumber, MIN_CARD_NUMBER_LENGTH); return Luhn.checkValidity(cleanedNumber); }  static void resetConfig(); static CardBrand getBrand(String cardNumber); static String validateCardNumber(String cardNumber); static boolean isValidCardNumber(String cardNumber); static String[] ALLOWED_CARD_NUMBERS_SPACING_CHARACTERS; }