Uploaded image for project: 'Clover'
  1. Clover
  2. CLOV-94

Clover incorrectly reports failing Instinct specifications when they expect an exception

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • Medium
    • 2.1.0
    • 2.0.2
    • Documentation
    • None
    • Linux duke 2.6.22-14-generic #1 SMP Sun Oct 14 23:05:12 GMT 2007 i686 GNU/Linux

    Description

      Clover reports a "failure" when running Instinct specifications that expect an exception. Instinct does not propagate the exception (perhaps JUnit 4 does), and instead handles it during specification running.

      Here's an example of what causes the failure, a screenshot is attached shoing how this manifests in the HTML report).

      @Specification(expectedException = IllegalArgumentException.class, withMessage = "Population cannot be chunked with chunk size (-1) less than 1")
      public void shouldNotAcceptNegativeChunkSize() {
          new PopulationToChunkMapperImpl(-1);
      }
      

      Changing the code to the following "works" (i.e. doesn't cause Clover to fail).

      public void shouldNotAcceptNegativeChunkSize() {
          try {
              new PopulationToChunkMapperImpl(-1);
              throw new RuntimeException("Expected exception not thrown");
          } catch (IllegalArgumentException e) {
              // all good
          }
      }
      

      Clover is enabled/configured as follows:

      <clover-setup initstring="${coverage.db}" tmpdir="${coverage.results.dir}/tmp" flushpolicy="threaded"
              flushinterval="${coverage.flush.interval}">
          <fileset refid="main.covered.fileset"/>
          <testsources dir="${spec.src.dir}">
              <testclass>
                  <testmethod annotation="Specification"/>
              </testclass>
          </testsources>
      </clover-setup>
      

      Maybe it's got something to do with how clover is configured. For example Instinct will also run spec methods (analogous to JUnit test methods) beginning with "should" and "must" however these do not appear to work correctly in all circumstances.

      This may be related to this issue: http://jira.atlassian.com/browse/CLOV-90.

      Attachments

        Issue Links

          Activity

            People

              npellow Nick
              e64e536854ef Tom Adams
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: