Raise a descriptive error when a required class is missing #634
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Currently when Mockery has been configured not to allow mocking non-existent methods, attempting to mock a non-existent class gives a confusing error. It complains that it can't mock methods that don't exist on the specified class, but actually the error is that mockery can't find the referenced class to mock it and verify the methods it's allowed to mock.
This commit changes that behaviour so that attempting to mock a class that doesn't exist throws an exception that explicitly says that the specified class doesn't exist, however it only does so while mockery is configured not to allow mocking of non-existent methods.
I'm not entirely certain that this is the right way to make this change, so feedback is appreciated. Also appreciated is feedback on if this change is considered desirable; no hard feelings if it's not!