How do I check if the function divides by zero?

I let the student build a function that calculates the average of an array
I want to check if the student put a test that should not be divided by zero or not
What code should I write in the test to see if his program checks for it

the code is in java