Skip to content

Instantly share code, notes, and snippets.

@sergio-sastre
Created July 18, 2021 10:02
Show Gist options
  • Save sergio-sastre/1205b0a63572021875ef9b1e55eceaaf to your computer and use it in GitHub Desktop.
Save sergio-sastre/1205b0a63572021875ef9b1e55eceaaf to your computer and use it in GitHub Desktop.
Multiplying the quality of your Unit Tests (Part2) with PBT - Jqwik Password Validator Property-Based Test
@Label("If password without upper case chars," +
"the error message contains 'no upper case letters'"
)
@Property
fun testPasswordValidatorRight(@ForAll("noUpperCase") password: String?) {
collectPasswordStats(password)
val actualError = passwordValidator.validate(password)
Truth.assertThat(actualError).contains("no upper case letters")
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment