Testing expected method with EasyMock gets IllegalStateException
<p>I am trying to test the service class to see if it calls the right method of the repository. The repository simply extends from <code>CouchDbRepositorySupport</code></p>

<h2>ServiceTest</h2>

<pre><code>@RunWith(EasyMockRunner.class)
@SpringApplicationConfiguration(App.class)
public class ServiceTest {

    @Rule
    public EasyMockRule mocks = new EasyMockRule(this);

    @TestSubject
    UserService userService = new UserServiceImpl();

    @Mock
    UserRepository userRepositoryMock;

@Test
    public void testGetUser() {
        User user = new User("Bob","bob87);

        user.setId("bob87"); //username is the id

        userService.getUser(user.getId());

        EasyMock.expect(userRepositoryMock.get(user.getId())).andReturn(user); //the line where the error occurs

        EasyMock.expectLastCall().times(1);

        EasyMock.replay(userRepositoryMock);

        EasyMock.verify(userRepositoryMock);
    }
}
</code></pre>

<p>However I get an IllegalStateException</p>

<blockquote>
  <p>java.lang.IllegalStateException: missing behavior definition for the
  preceding method call: CompanyRepository.get("Optis") Usage is:
  expect(a.foo()).andXXX()</p>
</blockquote>