title: How to mock a single method in java
body: <p>Is it possible to Mock a single method of a Java class?</p>
  
  <p>For example:</p>
  
  <pre><code>class A {
      long method1();
      String method2();
      int method3();
  }
  
  
  // in some other class
  class B {
      void someMethod(A a) {
         // how would I mock A.method1(...) such that a.method1() returns a value of my
         // choosing;
         // whilst leaving a.method2() and a.method3() untouched.
      }
  }
  </code></pre>