DEV Community

Harit Himanshu
Harit Himanshu

Posted on

2

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)

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more