*
The moose likes IDEs, Version Control and other tools and the fly likes A question about Blue J and testing Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » IDEs, Version Control and other tools
Bookmark "A question about Blue J and testing" Watch "A question about Blue J and testing" New topic
Author

A question about Blue J and testing

Edward Blom
Greenhorn

Joined: Jan 01, 2012
Posts: 4
I'm writing on a program in Blue J that got a class called dice that creates random numbers. How do I create a testing class that searches if the result of a function is between two numbers like 1-50?
I can only find a function that checks the result for a fixed value.
Peter Johnson
author
Bartender

Joined: May 14, 2008
Posts: 5823
    
    7

Edward, welcome to Java Ranch!

Try storing the result of the function in a variable and then using an expression to determine if the value is in range. Something like this:



I could be more specific if you were using JUnit, but I don't know what facilities BlueJ provides for testing.


JBoss In Action
 
Don't get me started about those stupid light bulbs.
 
subject: A question about Blue J and testing