public void validateCreditCardLimitAmount(String amount, String currency, String type) { if (type.equals(ArrangementType.CREDITCARD_ACCOUNT.toString())) { validateCurrencyAmount(amount, currency); } else if (!(amount.equals("") && currency.equals(""))) throw new IllegalArgumentException( "This type of arrangement should not have a Monthly Payment"); }
public void validateCreditCardNumber(String creditCardNumber, String type) { if (type.equals(ArrangementType.CREDITCARD_ACCOUNT.toString())) { String regex = "^[0-9]{16}$"; if (!creditCardNumber.matches(regex)) throw new IllegalArgumentException(creditCardNumber + " is not a valid creditcard number"); } else { if (!creditCardNumber.equals("")) throw new IllegalArgumentException( "This type of arrangement should not have a creditcard number"); } }