Uploaded image for project: 'Code Tools'
  1. Code Tools
  2. CODETOOLS-7902860

JCov ignored calls made from inner classes of test that were triggered by call of JDK

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: P3 P3
    • jcov_3.0
    • None
    • tools
    • None
    • Cause Known

      JCov seems to ignore calls made from inner classes of test that were triggered by call of JDK.

      For example the following approach for calling the tested method JInternalFrame::paintComponent(Graphics) leads to JCov not recording the coverage

      Say, we have a custom JInternalFrame that has paintComponent() method overridden to record the call and call super.paintComponent(g).

      public void myTest() {
         JInternalFrame jInternalFrame = new JInternalFrame("Internal frame") {
                  @Override
                  public void paintComponent(Graphics g) {
                      methodCalled.set(true);
                      super.paintComponent(g);
                  }
              };
             // showing frame to have paintComponent called
      }

      Method paintComponent() is called by Swing machinery when showing component, not directly by the test (and that's the idea of testing)
      however in the overridden version of the method super.paintComponent(g) is called explicitly after the call is recorded by the test.

      Yet this explicit call to super method is not recorded by JCov

            lkuskov Leonid Kuskov
            dbessono Dmitry Bessonov
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: