Skip to Main Content

Java Programming

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

JUnit Testing Random Strings

807605Oct 1 2007 — edited Oct 1 2007
Hi All,
I'm new to JUnit testing and have been assigned a task to JUnit test a random string. e.g.

function String returnRandomString(){
Random r = new Random();
String[] a = new String[]{"String1","String2",String3"};

return a[r.nextInt(3)];

}

If somebody could point me in the right direction it would be greatly appreciated.

Sam.

Edited by: sam.gribbles on Sep 30, 2007 9:19 PM
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Oct 29 2007
Added on Oct 1 2007
4 comments
1,772 views