Java Question Error in Boolen Function

Java Question Error in Boolen Function

por Aravind Aravind -
Número de respuestas: 2

Greetings!!! I have formulated question regarding boolean operator in MOODLE by the usage of Java Method even though I gave test cases properly it shows error in the following test cases used ..Plz got through the images let me know the solution. Same time I have used in Question type as Java class, Java method, java Program. I am getting same error again and again.


Awating your response. 

Anexo given test case.PNG
Anexo preview option.PNG
En respuesta a Aravind Aravind

Re: Java Question Error in Boolen Function

por Richard Lobb -

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.