title: Correct use of expectLastCall().once() in EasyMock
body: <p>I'm writing a junit test for a particular method. The method contains calls to other methods in a DAO class which I am mocking with EasyMock.</p>
  
  <p>I want to assert that one of these DAO class methods is called once, which is what I assume expectLastCall().once() is for. The method in question returns void.</p>
  
  <p>The test I have currently passes, I just want to make sure my logic is correct as I haven't used EasyMock before. I used this question as a reference: <a href="https://stackoverflow.com/questions/13917312/easymock-expectations-with-void-methods">EasyMock expectations with void methods</a></p>
  
  <p>So, here is the code:</p>
  
  <pre><code>    @Before
      public void setUp() throws Exception{
      this.fooService = new FooService();
      this.fooMock = createStrictMock(FooDAO.class);
      }
  
      @Test
      public void test_fooTest(){
  
      String arg1 = "arg1";
      String arg2 = "arg2";
      this.fooService.setFooDAO(fooMock);
      expect(this.fooMock.someMethod(arg1, arg2)).andReturn(something);
      fooMock.methodThatShouldBeCalledOnce(EasyMock.&lt;Object&gt;anyObject());
      EasyMock.expectLastCall().once();
      replay(this.fooMock);
      this.fooService.methodUnderTest(someArg, someArg2);
      verify(this.fooMock);
  
      }
  </code></pre>
  
  <p>What I think this does is assert that there is a call to methodThatShouldBeCalledOnce and that it only happens once. I don't really care about someMethod but of course EasyMock complains if it's not told to expect it.  </p>
  
  <p>Thank you!</p>