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

Avoid the negative-tests to behave as false-positive

    Details

    • Type: Task
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 2.10.3
    • Fix Version/s: 2.10.4, 2.11.0
    • Component/s: tests
    • Labels:
      None
    • Estimated Complexity:
      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

          Activity

            People

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

              Dates

              • Created:
                Updated:
                Resolved: