Uploaded image for project: 'Lucene - Core'
  1. Lucene - Core
  2. LUCENE-7009

Add expectThrows utility to LuceneTestCase

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • None
    • 6.0
    • None
    • None
    • New

    Description

      In junit5, a neat assertion method is added which makes testing expected
      failures a little more straightforward. The block of code that is
      expected to throw is passed in with a lambda expression, and the caught
      exception returned for inspection. The usage looks something like this:

      IOException e = expectThrows(IOException.class, () -> {
          throw new IOException("some io error");
      });
      // assert stuff here about the exception
      

      We should add this to LuceneTestCase until junit5 is available.

      Attachments

        1. LUCENE-7009.patch
          2 kB
          Ryan Ernst

        Activity

          People

            rjernst Ryan Ernst
            rjernst Ryan Ernst
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: