On Wed, 25 May 2022 17:19:22 GMT, Pavel Rappo <pra...@openjdk.org> wrote:

>> Yes. Although we could throw NPE even here, I was wanting to throw something 
>> that indicates the test is dysfunctional, as compared to failing or crashing.
>
> The rationale that you provided reminds of `new 
> FileInputStream(java.io.File)` that throws `FileNotFoundException`. Unlike 
> not finding a file, not finding a particular snippet is an unexpected, 
> unrecoverable programming error. I cannot imagine a reasonable test that 
> checks that some snippet is not there.

It's a reasonable analogy.

-------------

PR: https://git.openjdk.java.net/jdk/pull/8796

Reply via email to