Skip to content

Instantly share code, notes, and snippets.

@Senemix29
Created August 7, 2021 23:47
Show Gist options
  • Select an option

  • Save Senemix29/794408797c8f944344bf58e792aa2b48 to your computer and use it in GitHub Desktop.

Select an option

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
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