Java Question Error in Boolen Function

Re: Java Question Error in Boolen Function

by Richard Lobb -
Number of replies: 1

Your test code must generate some output - it is that output that is compared to the 'Expected' field in the test case to grade the code. Since none of your tests generate any output, the Got column is hidden (as is the Input column, since none of your tests specify any standard input).

So for example you might have a test like:

boolean result = parrotTrouble(true, 6);
System.out.println(result);

of perhaps just

System.out.println(parrotTrouble(true, 6));

The first version is slightly better because it will catch out the case of a student writing a string-valued function that returns the string "true" or the string "false".

Alternatively if you wish the test column to be simply a call to the function, as you've apparently assumed, you can modify the template to include the System.out.println. But that's less flexible - you can't write multiline test code.