When a method annotated with @Test(expected = ...) is overridden, the overriding method should not expect an exception.

XMLWordPrintable

    • Type: Bug
    • Resolution: Cannot Reproduce
    • Priority: Medium
    • won't fix
    • Affects Version/s: 3.0.2
    • Component/s: Instrumentation
    • None
    • Environment:

      Standalone
      Java 6
      Windows and Linux

      I have a test like this:
      @Test(expected = RuntimeException.class)
      public void somethingThrows()

      { something(); }

      In a subclass, I override the test without expecting an exception.
      @Override
      @Test
      public void somethingThrows(){ something(); }

      The test in the subclass should only fail if it DOES throw, but when Clover runs, it reports this as a failed test because it does not throw a RuntimeException.

        1. clov-970.zip
          197 kB
        2. clov-970-v2.zip
          201 kB

              Assignee:
              Marek Parfianowicz
              Reporter:
              Craig Motlin
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Created:
                Updated:
                Resolved: