Uploaded image for project: 'Camel'
  1. Camel
  2. CAMEL-5983

Avoid the negative-tests to behave as false-positive

    XMLWordPrintableJSON

Details

    • Task
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 2.10.3
    • 2.10.4, 2.11.0
    • tests
    • None
    • Unknown

    Description

      We've got bunch of (negative) tests on the current codebase expecting a thrown XYZException however they don't realize if the expected exception is not thrown, the typical pattern for this is:

      try {
       doSomething_With_Expectation_Of_A_Thrown_XYZException();
      } catch (XYZException e) {
       // expected
      }
      

      Which correctly should be:

      try {
       doSomething_With_Expectation_Of_A_Thrown_XYZException();
       fail("Should have thrown an exception");
      } catch (XYZException e) {
       // expected
      }
      

      Attachments

        1. CAMEL-5983-partial.patch
          9 kB
          Babak Vahdat

        Activity

          People

            bvahdat Babak Vahdat
            bvahdat Babak Vahdat
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: