title: Testing service layer without DAO
body: <p>Can you give me an example of how I test my service layer without the DAO using mock objects, Spring or any other framework. My Java code looks like this:</p>
  
  <pre><code>public int myServiceMethod(int number) {
  
      int myInt = Factory.getDAOImpl.getNumber();
      return myInt + number * 8;
  }
  </code></pre>
  
  <p>I want to test the logic of myServiceMethod but without testing the DAO method.
  Is it possible? Do I have to refactor it? Can you show me an example of how to test this simple method.
  Thank you</p>