Does anyone know how to show a custom failure message in ScalaTest?
For example:
NumberOfElements() should equal (5)
Shows the followin
You can also use withClue without importing anything or adding it to the test class:
withClue
withClue(s"Expecting distinct elements: ${elements.toList}") { elements.length shouldBe 3 }
This is imported from Assertions class: org.scalatest.Assertions#withClue
Assertions
org.scalatest.Assertions#withClue