<p>I am writing a unit test to check that a private method will close a stream.</p>

<p>The unit test calls methodB and the variable something is null</p>

<p>The unit test doesn't mock the class on test</p>

<p>The private method is within a public method that I am calling.</p>

<p>Using emma in eclipse (via the eclemma plugin) the method call is displayed as not being covered even though the code within the method is</p>

<p>e.g</p>

<pre><code>public methodA(){

    if (something==null) {
        methodB(); //Not displayed as covered
    }
}

private methodB(){
    lineCoveredByTest; //displayed as covered
}
</code></pre>

<p>Why would the method call not be highlighted as being covered?</p>

[{'answer_id': 56816, 'author': 'Stu Thompson', 'author_id': 2961, 'author_profile': 'https://Stackoverflow.com/users/2961', 'pm_score': 0, 'selected': False, 'text': "<p>I assume when you say 'the unit test calls <code>methodB()</code>', you mean not directly and via <code>methodA()</code>. </p>\n\n<p>So, is it possible <code>methodB()</code> is being called elsewhere, by another unit test or <code>methodC()</code> maybe?</p>\n"}, {'answer_id': 72586, 'author': 'fivemile', 'author_id': 12219, 'author_profile': 'https://Stackoverflow.com/users/12219', 'pm_score': 2, 'selected': False, 'text': '<p>I have found that the eclipse plugin for EMMA is quite buggy, and have had similar experiences to the one you describe.  Better to just use EMMA on its own (via ANT if required).  Make sure you always regenerate the metadata files produced by EMMA, to avoid merging confusion (which I suspect is the problem with the eclipse plugin).</p>\n'}]
['https://Stackoverflow.com/questions/56373', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/-1/']