Uploaded image for project: 'Policy Framework'
  1. Policy Framework
  2. POLICY-2451

Replace try/catch checking for exceptions in unit tests with assertj assertions.

XMLWordPrintable

    • Policy 6/8-6/19, Policy 6/23-7/06, Policy 7/06-7/17, Policy 7/20-7/31

      There are many usages of try/catch blocks for checking exceptions in unit tests with code similar to this:

      try {
         executor.executePost(false);
         fail("test should throw an exception");
      } catch (Exception ex)

      {    assertEquals("execution post work not implemented on class", ex.getMessage()); }

      Such code should be replaced with assertj assertions:

      assertThatCode(() -> executor.executePost(false)).hasMessage("execution post work not implemented on class");

       

       

            waynedunican Wayne Dunican
            liamfallon liamfallon
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: