[
https://issues.apache.org/jira/browse/LUCENE-7037?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15154342#comment-15154342
]
Uwe Schindler commented on LUCENE-7037:
---------------------------------------
Thanks for the cleanup! +1 to commit this as first step. I did only skim
through the patch, but looks fine! I love this!
I have some unrelated comments:
- Maybe we should improve the expectThrows() assertion to also take a message
like assertEquals(message,...). I just noticed that some messages were
converted to comments in this patch (thanks), so I thought about that.
- About the multi-catch: I feel the same: FileNotFoundException should not be
allowed anymore in Lucene 6. Only NoSuchFileException! BASTA :-) So clean up
APIs. The old style RAFDirectory must then just convert them correctly and we
assert that!
> Switch all exception tests to expectThrows()
> --------------------------------------------
>
> Key: LUCENE-7037
> URL: https://issues.apache.org/jira/browse/LUCENE-7037
> Project: Lucene - Core
> Issue Type: Bug
> Reporter: Robert Muir
> Attachments: LUCENE-7037.patch
>
>
> Tests expecting exceptions today are done in various ways.
> The best ones look like this.
> {code}
> try {
> something();
> fail("message");
> } catch (Exception expected) {
> assertSomethingAbout(expected);
> }
> {code}
> But there are many forms (involving booleans and such). All of these are a
> little sketchy because it is all-too easy to just forget the {{fail()}} and
> then the whole test is useless.
> `expectThrows` was added in LUCENE-7009 which solves a lot of these problems.
> Its not perfect, but overall a big improvement. We should cut over all of our
> tests.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]