@Test public void isInputAcceptable_if_spacing_is_not_allowed_rejects_the_spacing() { CreditCard4J.ALLOWED_CARD_NUMBERS_SPACING_CHARACTERS = new String[]{}; String number = "12 34-567"; boolean accept = CardNumberCleaner.isInputAcceptable(number); assertFalse(accept); }
protected static boolean isInputAcceptable(String cardNumber) { String regex = "[0-9"; for (String spacing : CreditCard4J.ALLOWED_CARD_NUMBERS_SPACING_CHARACTERS) { regex += spacing; } regex += "]*"; return cardNumber.matches(regex); }
CardNumberCleaner { protected static boolean isInputAcceptable(String cardNumber) { String regex = "[0-9"; for (String spacing : CreditCard4J.ALLOWED_CARD_NUMBERS_SPACING_CHARACTERS) { regex += spacing; } regex += "]*"; return cardNumber.matches(regex); } }
CardNumberCleaner { protected static boolean isInputAcceptable(String cardNumber) { String regex = "[0-9"; for (String spacing : CreditCard4J.ALLOWED_CARD_NUMBERS_SPACING_CHARACTERS) { regex += spacing; } regex += "]*"; return cardNumber.matches(regex); }  }
CardNumberCleaner { protected static boolean isInputAcceptable(String cardNumber) { String regex = "[0-9"; for (String spacing : CreditCard4J.ALLOWED_CARD_NUMBERS_SPACING_CHARACTERS) { regex += spacing; } regex += "]*"; return cardNumber.matches(regex); }  static String clean(String cardNumber); }
CardNumberCleaner { protected static boolean isInputAcceptable(String cardNumber) { String regex = "[0-9"; for (String spacing : CreditCard4J.ALLOWED_CARD_NUMBERS_SPACING_CHARACTERS) { regex += spacing; } regex += "]*"; return cardNumber.matches(regex); }  static String clean(String cardNumber);  }