In this solution, we're quality control the store class, we need to forbid the caller from misusing
the methods or the constructor, the constructor doesn't receive any parameters.
So there's nothing to check here.
There is nothing to quality control in the setar, because if the caller happens to pass a no instead
of an actual object, the code would already throw a nail pointer exception.
So throwing our own exception would be redundant.
The same thing can be said for ad movie.
However, there's a lot to quality control in the action, first of all, if the store object doesn't
have any movies, then it's not an illegal state to call the method.
You can't return, sell or rent a movie that doesn't exist.
So here, we'll say if movies, that is empty.
We'll throw a new.
Illegal state exception.
Store not in a valid state to perform action.
One more thing we want to check is that the action they want to perform can only be one of three things
sell, rent or return.
So if the caller passes anything else, we need to throw an exception.
So if the auction they pass, if it doesn't equal sell.
Or if it doesn't equal rent.
Or if it doesn't equal return.
Then we'll throw a new illegal argument exception.
Action must be sell, rent or return.
All right, and the color shouldn't be allowed to pass a name that's blank, so if the name is equal
to No.
Or the name is equal to blank.
We'll throw a new illegal argument exception.
Name Kaname Neller Black.
And the last thing we're going to do is forbid the caller from trying to sell a movie that has already
been rented.
So inside, so we're going to check if the movie at the index.
That was a request that is not available.
Then we're going to throw a new illegal state exception, because the state of the movie object that
we're trying to sell is inappropriate for this operation.
We'll just say cannot sell a movie that was rented out.
And that's all the quality control we need to apply and now this method is going to forbid the caller
from misusing it, if the caller does misuse it, their application is going to crash and they're going
to have to fix their code.