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

Add expectThrows utility to LuceneTestCase

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 6.0
    • Component/s: None
    • Labels:
      None
    • Lucene Fields:
      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

          Activity

            People

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

              Dates

              • Created:
                Updated:
                Resolved: