title: Different code coverage from Jacoco and Intellij
body: <p>I am trying to integrate <code>Jacoco</code> in my project. 
  I have a simple class</p>
  
  <pre><code>package in.ashwanik.project;
  
  import java.util.Objects;
  
  public class ArithmeticOperations {
  
      public int add(Integer a, Integer b) {
          Objects.requireNonNull(a);
          Objects.requireNonNull(b);
          return a + b;
      }
  }
  </code></pre>
  
  <p>And the corresponding test cases</p>
  
  <pre><code>package in.ashwanik.project;
  
  import org.junit.Test;
  
  public class ArithmeticOperationsTest {
  
      @Test(expected = NullPointerException.class)
      public void testAddA() {
          ArithmeticOperations entity = new ArithmeticOperations();
          entity.add(null, 1);
      }
  
      @Test(expected = NullPointerException.class)
      public void testAddB() {
          ArithmeticOperations entity = new ArithmeticOperations();
          entity.add(1, null);
      }
  }
  </code></pre>
  
  <p><strong><em>I have intentionally left out the test case which passes not null parameters.</em></strong></p>
  
  <p>Command to run <code>Jacoco</code> tests.</p>
  
  <pre><code>./gradlew clean build test jacocoTestReport
  </code></pre>
  
  <p>When I run <code>Jacoco</code> on this project, the code coverage is only 40%.</p>
  
  <p><a href="https://i.stack.imgur.com/JOE5l.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/JOE5l.png" alt="enter image description here"></a></p>
  
  <p>However, when I run IntelliJ code coverage, I get 75%</p>
  
  <p><a href="https://i.stack.imgur.com/Ff10w.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Ff10w.png" alt="enter image description here"></a></p>
  
  <p>Test cases run
  <a href="https://i.stack.imgur.com/bhfZL.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/bhfZL.png" alt="enter image description here"></a></p>
  
  <p>I am not sure why this discrepancy is there?</p>
  
  <p><strong>How can I have the same coverage from both the tools?</strong></p>