I am Working on a project that requires me to generate different json files for use during end-to-end based testing.
one of the requirments is that the system can handle internationalization i.e. different character types.
I’ve managed to develop a simple random string sat within a method that produces different Latin characters when ever i need it:
return RandomStringUtils.random(characterAmount, true, false);
However the next step is to cover internationalization, and i need it to generate random strings in Arabic character cases.
Would anybody have any tips on how best to go about this ?
Well, the easy way would be to just pick random Arabic characters (check out the Unicode Chart for their location: http://unicode.org/charts/PDF/U0600.pdf and pick the characters you want).
Unfortunately, that would create illegal Arabic strings – letters that should appear at the beginning of the word can be anywhere, the same for ending letters, and nobody knows where you’re going to get those floating Hamzas. If you need your strings to be more ‘Arabic compliant’, I would do something different:
Take a big file of Arabic text, split it into words and choose words at random. Nothing beats the Quran for that: http://www.sacred-texts.com/isl/uq/index.htm