title: How do I determine branch coverage (from a control flow graph)?
body: <p>I have the following piece of code (doesn't matter if it's a good method or not):</p>
  
  <pre><code>public boolean adjacent(Cell otherCell) {
  
    boolean result;
    boolean xdiffersone = Math.abs(getX() - otherCell.getX()) == 1;
    boolean ydiffersone = Math.abs(getY() - otherCell.getY()) == 1;
  
    if((xdiffersone &amp;&amp; !ydiffersone) || (!xdiffersone &amp;&amp; ydiffersone)) {
  
      result = true;
    }
    else {
      result = false;
    }
  
    return result;
  }
  </code></pre>
  
  <p>The control flow graph of this method:</p>
  
  <p><img src="https://i.stack.imgur.com/kaXcR.png" alt="control flow graph"></p>
  
  <p>I know that statement coverage means whether all the nodes in a control flow graph have been executed/visited. But what exactly is branch coverage? How can I calculate/see that from a control flow graph (or from the code)?</p>