Question Authors' Forum

Test case to check if attribute is set to private (Java)

Re: Test case to check if attribute is set to private (Java)

de Matthew Toohey -
Número de respuestas: 0

I agree that output like that would be much nicer. One way this could be achieved would be to customise the template and add a function (that would be hidden from students) that checks for this. The test would then become something like checkAccessModifiers() and this function would do all the checks and print out informative information to students. If they have done everything right the function might just print something like "Access modifiers correct" and if they have done something wrong the function could print out an explanation of what is incorrect.

There are many ways to do more advanced checking with coderunner. However, the default java question types are quite limiting. Which is why you may want to consider customising question templates or defining your own question prototypes.