DEV Community

Harit Himanshu
Harit Himanshu

Posted on

How to know when to use `a`, `an` or `the` in ScalaTest Matchers when asserting exceptions?

I am reading the section on Testing Exceptions on ScalaTest documentation and looking at examples such as

an [IndexOutOfBoundsException] should be thrownBy s.charAt(-1)

I tested a and that works too

a [IndexOutOfBoundsException] should be thrownBy s.charAt(-1)

and

val thrown = the [IndexOutOfBoundsException] thrownBy s.charAt(-1)

I am confused and there is…

Top comments (0)