Close
jGuru Forums
Posted By: Anonymous Posted On: Tuesday, February 25, 2003 10:40 AM
Is there any easy way to test with JUnit a method that returns a range of values like, for instance, in a method that rolls a die and the result has to be between 1 and 6?
Re: Testing methods that return a range of results
Posted By: David_Bates Posted On: Saturday, March 1, 2003 03:16 PM
private Dice myDice; public void setup() { myDice = new Dice(); } public void testDiceThrow() { int lowest = 1; int highest = 6; int result; result = myDice.throw(1, 6); assertTrue(result >= lowest && result <= highest); }
Posted By: Anonymous Posted On: Wednesday, February 26, 2003 05:55 AM