Skip to main content

assertTrue

Validates an expression to be of type boolean true. An optional failureMessage can be given for displaying should the validation fails.

assertTrue(expression)
# Or
assertTrue(expression, failureMessage)

Parameters#

  • expression: An expression that must evaluate to a boolean
  • failureMessage: An optional string message to show when validation fails

Returns#

  • No value

Example#

assertTrue(!false && length([1]) > 0 && containsKey({name: 'Bo'}, 'name'))
assertTrue(nonEmpty('  '), 'Given string is empty')