title: EasyMock returning null
body: <p>I am currently working on some test cases which use <code>EasyMock</code>. My example code looks like this:</p>
  
  <pre><code>{
      dao = EasyMock.createNiceMock(Dao.class);
  
      initObj();
      EasyMock.replay(dao);
      // EasyMock.verify(dao);
  
      mapper = new Mapper();
      mapper.setDao(dao);
  }
  @Test
  public void testmapper(){ 
      mapper.map();
  }
  
  public void initObj() {
      Obj o = new Obj();
      o.setX(2);
      EasyMock.expect(dao.findObj(1)).andReturn(o);
  }
  
  class Mapper {
      @Autowired
      private Dao dao;
  
      public Obj map(){
          Obj o = dao.findObj(1);
          System.out.println(o.getX());
          return o;
      }
      //getter and setter
  }
  </code></pre>
  
  <p>if I actually call <code>EasyMock.verify(dao);</code>, it throws </p>
  
  <pre><code>java.lang.AssertionError: 
    Expectation failure on verify:
      dao.findObj(1): expected: 1, actual: 0
      at org.easymock.internal.MocksControl.verify(MocksControl.java:183)
      at org.easymock.EasyMock.verify(EasyMock.java:2142)
      ...
  </code></pre>
  
  <p>and if I don't call verify, my first call inside the <code>Mapper</code> class on my <code>Obj</code> results in an NPE. I am very new to EasyMock and could not yet find the reason why it is not returning the <code>Obj</code> I created in <code>initObj</code>. Any enlightenment is welcome. I read some question on SO to this topic as well as some simple tutorials, but they didn't help me </p>