Last active
August 7, 2021 23:51
-
-
Save Senemix29/fd11dbc12614d29e9ae5c9b5c9b55dc2 to your computer and use it in GitHub Desktop.
A test class to be used as an 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
| class NameValidatorTest { | |
| private val nameValidator = NameValidator() | |
| @Test | |
| fun 'isValid should return false when name is empty'() { | |
| val name = "" | |
| assertEquals(false, nameValidator.isValid(name)) | |
| } | |
| @Test | |
| fun 'isValid should return false when name lenght is lower than MIN_NAME_LENGTH'() { | |
| val name = "El" | |
| assertEquals(false, nameValidator.isValid(name)) | |
| } | |
| @Test | |
| fun 'isValid should return true when name is valid'() { | |
| val name = "Messi" | |
| assertEquals(true, nameValidator.isValid(name)) | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment