public void validateOverDraftLimitAmount(String amount, String currency, String type) { if (type.equals(ArrangementType.CURRENT_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 validateSortCode(String sortCode, String type) { if (type.equals(ArrangementType.SAVINGS_ACCOUNT.toString()) || type.equals(ArrangementType.CURRENT_ACCOUNT.toString())) { String regex = "^[0-9]{6}$"; if (!sortCode.matches(regex)) throw new IllegalArgumentException(sortCode + " is not a valid sort code"); } else { if (!sortCode.equals("")) throw new IllegalArgumentException("This type of arrangement should not have a sort code"); } }
public void validateAccountNumber(String accNumber, String type) { if (type.equals(ArrangementType.SAVINGS_ACCOUNT.toString()) || type.equals(ArrangementType.CURRENT_ACCOUNT.toString())) { String regex = "^[0-9]{8}$"; if (!accNumber.matches(regex)) throw new IllegalArgumentException(type + " is not a valid account number"); } else { if (!accNumber.equals("")) throw new IllegalArgumentException(type + " is not a valid account number"); } }