Quidditch – Part 6
Goal: Quality control the
An unchecked exception crashes the app as a result of badly written code.
You should throw an:
IllegalArgumentExceptionwhen the caller passes faulty arguments into a method/constructor.
IllegalStateExceptionwhen an object calls its method at a "bad time" (object not in a legal state).
Throwing an unchecked exception forces the caller to improve their code.
Task 1 – Inspecting the
setScoreis vulnerable to receiving
nullobjects and adding them as keys. Throw an
IllegalArgumentExceptionto prevent that.
All other methods/constructors will respond appropriately when presented with illegal arguments.