castlemock
castlemock copied to clipboard
Help Generating Random Alphanumeric
Is your feature request related to a problem? Please describe. In order to simulate the response of an underlying application I need to generate a random alphanumeric 10 digit value, uppercased.
Describe the solution you'd like Either with the use of faker or an already supported expression, to generate a 10 digit uppercased alphanumeric value. Obviously the 10 digits doesn't need to be fixed e.g. ${RANDOM_ALPHANUMERIC(10)} or along those lines.
Describe alternatives you've considered I've tried to achieve this with faker but struggling to find a solution here also.
Additional context Example output would be 9NP8EOC6DA
Hi, @kierangirvan! Try ${FAKER(api="finance().bic().substring(0,10)")}
.
If you need one more specific rule, try ${FAKER(api="regexify('([A-Z]){4}([A-Z]){2}([0-9A-Z]){2}([0-9A-Z]{3})?')")}
, passing the rule in the regex expression. For example, https://github.com/DiUS/java-faker/blob/master/src/main/java/com/github/javafaker/Finance.java#L54