title: How to mock external dependencies for final objects?
body: <pre><code>public class A{
     private final B b;
     public void meth() {
        //Some code
        Integer a = b.some_method(a,fun(b));
        //Some code
     }
     private fun(int b) {
       return b;
     }
  }
   when(b.some_method(anyInt(),anyInt())).thenReturn(100)
  </code></pre>
  
  <p>How to mock the externally dependency when writing unit tests for class A. When i mock dependency in the above way, the value of "a" is not getting assigned to 100 as expected. </p>