DEV Community

Discussion on: Why code coverage is not a reliable metric

Collapse
 
ervis profile image
Ervis Zyka • Edited

The return type of ValidateEmail is void and you return a boolean value in your method. Also the fact that your test doesn't contain any assertions makes it hard to understand since you don't explicitly state your expectation.

You should either return a boolean flag to indicate success/failure or throw an exception in case the the email is invalid. If you throw an exception you have to catch it in your test and mark the the test as a failing test so everyone who reads it can understand what happened when it fails.

Thanks for sharing your thoughts.

Collapse
 
conectionist profile image
conectionist

Good catch!
I made the suggested changes.
Thanks for the code review. ;)