arturmkrtchyan / iban4j

A Java library for generation and validation of the International Bank Account Numbers (IBAN ISO_13616) and Business Identifier Codes (BIC ISO_9362).
http://iban4j.org
Apache License 2.0
271 stars 124 forks source link

Create IBANs with one or more fields randomly filled. #23

Closed jmyounker closed 9 years ago

jmyounker commented 9 years ago

Hi, I've got some some changes which may others may find useful. Our primary use for this library has been generating test data. As such, we've needed IBANs with one or more fields randomly filled.

This is done in the Iban.Builder class. When the new buildRandom() method is called it uses the Bban definitions to supply random values for any fields which have not been supplied. So, if you want to generate an Austrian IBAN for the bank with code 11111 you call:

new Iban.Builder().countryCode(CountryCode.AT).bankCode("11111").randomIban()

The call new Iban.Builder().randomIban() generates a completely random Iban.

There are convenience methods in the Iban class. These are Iban random() and Iban random(CountryCode).

arturmkrtchyan commented 9 years ago

@jmyounker thank you for the pull request. I was thinking some time back to add random generation. Will review the pull request and merge it soon.

jmyounker commented 9 years ago

Please let me know if there is anything you'd like updated or changed.

arturmkrtchyan commented 9 years ago

@jmyounker Thank you very much. Merged will release new version of the library today. v3.1.0 is available now.