Hi All,
Is it feasible to test already compiled source file with JUnit? A task
was given to me to test the bytecode (.class file) without having the
source code. I do have the API docs and based on that I can come up
with oracles to determine the expected outcome. I do not know how to
do that with JUnit.
Thanks a million
Hunter Gratzner - 26 Nov 2007 18:19 GMT
> Hi All,
>
> Is it feasible to test already compiled source file with JUnit?
Yes, that's JUnits normal mode of operation.
> I do not know how to
> do that with JUnit.
Read the JUnit documentation.
Alex - 26 Nov 2007 18:52 GMT
As usual. (Use Eclipse, it does it automatically):
public class RandomIntTest extends TestCase {
public void testNextInt() {
int one=random.nextInt();
int two=random.nextInt();
assertFalse("Two random ints are equal "+one+"="+two, one==two);
}
}
-- Alex
Lew - 26 Nov 2007 23:53 GMT
> As usual. (Use Eclipse, it does it automatically):
>
[quoted text clipped - 7 lines]
>
> }
The problem with this particular test is that two consecutive random ints can
legitimately be equal.
A good pseudorandom generator will be no more prejudiced against a second
value equal to the first than any other second value.

Signature
Lew