/ Published in: Scala
A simple Scala unit test example using FlatSpec and ShouldMachers in scalatest
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
package scalaunittest "A List" should "have length as count of elements in it" in { xs.length should be (3) } it should "contains elements passed in the factory method" in { } it should "throw IndexOutOfBounds exception when index is out of bounds" in { evaluating { xs(4) } should produce [IndexOutOfBoundsException] } }