简体   繁体   中英

java.lang.IllegalStateException: calling verify is not allowed in record state in easymock

I have a very big Integration test where it is failing with calling verify is not allowed in record state in easy mock.

I could not figure out what exactly causing the issue.

in @After there are some mocks below

@After
public void after(){
  mock(a,b,c);
  replay();
   verify(a,b,c);
}

exception is coming at verify, if someone has a clue what could be possible scenarios. please help me.

You need to pass the mocks to replay . And I don't get your mocking part. Please, next time, give a real example.

@After
public void after(){
  var a = mock(A.class);
  var b = mock(B.class);
  var c = mock(C.class);
  //  ... expectations ...
  replay(a, b, c);
  // ... test...
  verify(a, b, c);
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM