Why don't you simply have a ```boolean``` to know if a warning has been added to the context and test it just below instead of having the ```hasWarningMessage``` method?