Created
August 7, 2021 23:47
-
-
Save Senemix29/794408797c8f944344bf58e792aa2b48 to your computer and use it in GitHub Desktop.
A NameValidator class to be used as and example at a Medium post about testing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| private const val MIN_NAME_LENGTH = 3 | |
| class NameValidator { | |
| fun isValid(name: String): Boolean { | |
| return when { | |
| name.isEmpty() -> false | |
| name.length < MIN_NAME_LENGTH -> false | |
| else -> true | |
| } | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment