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
Register / Login
JavaRanch » Java Forums » Engineering » IDEs, Version Control and other tools
Reply 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: 4875

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
 
 
subject: A question about Blue J and testing
 
Threads others viewed
anonumous arrays?
Zero division
JQuest question
Blue J (IDE)
Generic Binary Search for Ints & Strings
MyEclipse, The Clear Choice

cast iron skillet 49er

more from paul wheaton's glorious empire of web junk: cast iron skillet diatomaceous earth rocket mass heater sepp holzer raised garden beds raising chickens lawn care CFL flea control missoula heat permaculture