title: Ignore code while testing a function using junit
body: <p>I am trying to write test case for my java function. My function is something of the following type</p>
  
  <pre><code>public static String parse33_05_x_Data(String message, Transaction transaction){
      String returnValue="";
      /**
      *Some Java code which I actually want to test.
      *
      **/
      //Writing the transaction to the file.
      FileManager.getInstance().WriteDataToFile(transaction);
      return returnValue;
  }
  </code></pre>
  
  <p>But in the above code I want to somehow <strong>ignore/mock</strong> the line <code>FileManager.getInstance().WriteDataToFile(transaction);</code> as it is giving an exception. without making any code changes to the above function itself.</p>
  
  <p>Whatever changes are required should happen inside my <code>Test class</code>.</p>
  
  <p>Is it possible to do something like this?</p>
  
  <p>Thanks in advance!</p>